Skip to main content
Version: Next

length_chars

Returns the length of a string in characters.

length_chars(x:string) -> int

Description

The length_chars function returns the character length of the x string.

Examples

Get the character length of a string

For ASCII strings, the character length is the same as the number of bytes:

from {x: "hello".length_chars()}
{x: 5}

For Unicode, this may not be the case:

from {x: "👻".length_chars()}
{x: 1}

See Also

length, length_bytes