LTRIM()
All functions > STRING > LTRIM()
Returns the string with whitespace from the left (beginning) removed.
Signatures
Returns: String with leading whitespace removed
LTRIM(string: VARCHAR, [characters: VARCHAR]) → VARCHAR sql
| Parameter | Type | Required | Description |
|---|---|---|---|
string | VARCHAR | Yes | String to trim |
characters | VARCHAR | No | Characters to remove from the start (optional; default trims whitespace) |
Notes
- Removes leading whitespace only (spaces, tabs, line breaks, and similar) when
charactersis omitted - With
characters, removes leading code points that appear in that string - Trailing and internal whitespace are unchanged
LTRIM('')is''; if the input is NULL the result is NULL (useNULL(VARCHAR); bareNULLfails inference)
Examples
FeatureQL
SELECT
-- Trim left only
f1 := LTRIM(' hello '),
-- Trim tab from left
f2 := LTRIM(' world '),
-- Only left trim
f3 := LTRIM(' mixed spaces '),
-- No left whitespace
f4 := LTRIM('no trim needed'),
-- NULL yields NULL
f5 := LTRIM(NULL(VARCHAR)),
-- Trim custom characters
f6 := LTRIM('xxhello', 'x')
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR | f4 VARCHAR | f5 VARCHAR | f6 VARCHAR |
|---|---|---|---|---|---|
| hello | world | mixed spaces | no trim needed | NULL | hello |
On this page