Lengths of strings
To find the length of the largest array dimension of str
,
use the length
function, not
strlength
.
strlength
counts the number of code units in text.
Code units are bit sequences for encoding characters of a character encoding system. In
some character encodings, such as UTF-16, there are some characters that are encoded
with multiple code units.
If you have a string or a character vector that contains such characters, then the number of code units is greater than the number of characters.
length(C)
also returns the number of code
units when C
is a character vector.