Returns the length of a string.
Be aware that the length represents the number of bytes and not the number of characters. see example below.
This function does not generate a change.
str.len()
None
Returns length of the string.
This code uses
len()
to return the length of a string:
[
{'Hello'.len(); /* 5 bytes */ },
{'π'.len(); /* 2 bytes, not 1 */ },
]
Return value in JSON format
[
5,
2
]