Are strings also a collection? And how are characters represented?

This episode explains that strings do in many ways represent a collection of characters. Many programming languages will allow you to work with the individual characters just like you would work with individual items in an array.

some languages like C# have immutable strings which means that once a string is constructed, then it can’t be changed. You might think you’re changing a C# string but in fact all you’re doing is creating a new string with the modified value.

The traditional method for determining the end of a string is to place a null value at the end. This is called a null terminated string. But what do you do if you want embedded null characters inside your string? My recommendation is that you don’t do this and instead select a different collection such as an array or vector of characters.

The final topic that this episode explores is how character values are represented. You’ll learn about ASCII (American Standard Code for Information Interchange) and Unicode and how Unicode encodes characters. A common encoding used today is called UTF-8.