String Length, Literals and Comparison

In this lesson, we will discuss potentially confusing length of strings, string literals and comparisons of strings.

Potentially confusing length of strings #

We have seen that some Unicode characters are represented by more than one byte. For example, the character ‘é’ (the latin letter ‘e’ combined with an acute accent) is represented using at least two bytes in UTF-8 encoding. This fact is reflected in the .length property of strings:

Get hands-on with 1200+ tech skills courses.