We can also get the number of bytes in a string:
iex > byte_size ( "hellö" ) 6 Notice that the number of bytes in that string is 6, even though it has 5 graphemes. That’s because the grapheme “ö” takes 2 bytes to be represented in UTF-8. We can get the actual length of the string, based on the number of graphemes, by using the String.length/1 function:
iex > String . length ( "hellö" ) 5 | status | not read | reprioritisations | ||
|---|---|---|---|---|
| last reprioritisation on | suggested re-reading day | |||
| started reading on | finished reading on |