Skip to content
Legacy docs for Tenzir v5.x. For the latest Tenzir v6 series, visit docs.tenzir.com. Migrating from v5? Read the Tenzir v6 migration guide.

Returns the length of a string in bytes.

length_bytes(x:string) -> int

The length_bytes function returns the byte length of the x 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}

Last updated: