StringLength

Parameters
sstring
comment

Returns the length of the string in bytes. This means Unicode (non-ASCII) characters will take up and return a higher byte count than there are letters.

Examples (Reforged 2.0.4):

StringLength("a") == 1
StringLength("я") == 2
StringLength("中") == 3
StringLength("😀") == 4

There is no native that returns the number of characters. See StringHash for a byte-based technique that widens each slice until it contains a complete UTF-8 character.

pure
This function is pure. For the same values passed to it, it will always return the same value.
patch

1.13

Source
common.j (raise an issue to discuss on Github or submit a PR)
return type
integer
Source code
native StringLength takes string s returns integer