Colon notation: str:len()
Return the number of bytes in str.
The number of bytes in a string is not necessarily equivalent to its amount of characters! Many Unicode characters take up more than one byte. For example,
2. Hence, string.len only returns the amount of characters if str is encoded in an encoding that only uses one byte per character, such as ASCII.
|Read a line from the user, then print the length of the string they entered.|
<nowiki> print(string.len(read())) </nowiki>
|Output||Depends on what the user wrote. For instance, if they were to enter