Skip to content

length - Get the length of a string

The length function will return a count of the number of individual characters in a string.

Syntax

length(value: string): number

Arguments

Name Type Required Description
value string true The string whose length we seek

Example - Basic usage

There are two ways to invoke length, either as a function of a string or as a standalone function.

Consider the following document:

{
    "str_val": "Hello world!"
}

If I wish to get the length of str_val, and store it in a new field entitled str_val_len, I can do so in two ways:

create str_val_len from str_val.length()

I can also invoke length on a field separately:

create str_val_len from length(str_val)