This is the ThingsDB documentation for version v0, click here for the latest version!

len

Returns the length of a string.

Be aware that the length represents the number of bytes and not the number of characters. see example below.

This function does not generate an event.

Function

str.len()

Arguments

None

Return value

Returns length of the string.

Example

This code uses len() to return the length of a string:

[
    {'Hello'.len();  /* 5 bytes */ },
    {'π'.len();      /* 2 bytes, not 1 */ },
]

Return value in JSON format

[
    5,
    2
]