Skip to main content
Version: Next

length_bytes

Returns the length of a string in bytes.

length_bytes(x:string) -> int

Description

The length_bytes function returns the byte length of the x string.

Examples

Get the byte length of a string

For ASCII strings, the byte length is the same as the number of characters:

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

For Unicode, this may not be the case:

from {x: "👻".length_bytes()}
{x: 4}

See Also

length, length_chars