String.len
String.len
Function
Returns the string length. ASCII strings are measured in bytes; non-ASCII strings are measured in Unicode characters.
Syntax
string.len()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Int | Returns the string length. |
Example
text = 'hello BT' result = text.len() // Output: 8 print result
Notes
- The original string is not modified.
- The length of the ASCII string is equal to the number of bytes; when it contains non-ASCII characters such as Chinese, it is returned by the number of characters.