RTRIM()

All functions > STRING > RTRIM()

Returns the string with whitespace from the right (end) removed.

Signatures

Returns: String with trailing whitespace removed

RTRIM(string: VARCHAR) → VARCHAR
sql
ParameterTypeRequiredDescription
stringVARCHARYesString to trim

Notes

  • Removes trailing whitespace only (spaces, tabs, line breaks, and similar)
  • Leading and internal whitespace are unchanged
  • RTRIM('') is ''; if the input is NULL the result is NULL (use NULL(VARCHAR); bare NULL fails inference)

Examples

FeatureQL
SELECT
    f1 := RTRIM('  hello  '), -- Trim right only
    f2 := RTRIM('  world	'), -- Trim tab from right
    f3 := RTRIM('  mixed   spaces  '), -- Only right trim
    f4 := RTRIM('no trim needed'), -- No right whitespace
    f5 := RTRIM(NULL(VARCHAR)) -- NULL yields NULL
;
Result
f1 VARCHARf2 VARCHARf3 VARCHARf4 VARCHARf5 VARCHAR
hello world mixed spacesno trim neededNULL

Last update at: 2026/05/26 17:22:09