LENGTH()
All functions > STRING > LENGTH()
Returns the number of characters in a string.
Signatures
Returns: Number of characters in the string
LENGTH(string: VARCHAR) → BIGINT sql
| Parameter | Type | Required | Description |
|---|---|---|---|
string | VARCHAR | Yes | Input string to measure |
Notes
- Counts every character position in the string—letters, digits, spaces, symbols, and emoji each add one
LENGTH('')is 0; if the input is NULL the result is NULL (useNULL(VARCHAR); bareNULLfails inference)- Aliases:
LEN,SIZE(same function)
Aliases
LENSIZE
Examples
FeatureQL
SELECT
f1 := LENGTH('Hello World'), -- Basic string length
f2 := LENGTH('ABC'), -- Short string
f3 := LENGTH(' spaces '), -- Spaces are counted
f4 := LENGTH('😀😁'), -- Emoji characters
f5 := LENGTH('€100'), -- Euro symbol counts as 1
f6 := LEN('test'), -- Using alias LEN
f7 := SIZE('x'), -- Using alias SIZE
f8 := LENGTH(NULL(VARCHAR)) -- NULL string yields NULL
;Result
| f1 BIGINT | f2 BIGINT | f3 BIGINT | f4 BIGINT | f5 BIGINT | f6 BIGINT | f7 BIGINT | f8 BIGINT |
|---|---|---|---|---|---|---|---|
| 11 | 3 | 10 | 2 | 4 | 4 | 1 | NULL |
On this page