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
ParameterTypeRequiredDescription
stringVARCHARYesString to trim
charactersVARCHARNoCharacters to remove from the start (optional; default trims whitespace)

Notes

  • Removes leading whitespace only (spaces, tabs, line breaks, and similar) when characters is 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 (use NULL(VARCHAR); bare NULL fails 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 VARCHARf2 VARCHARf3 VARCHARf4 VARCHARf5 VARCHARf6 VARCHAR
hello world mixed spaces no trim neededNULLhello

Last update at: 2026/06/20 10:08:10