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, [characters: VARCHAR]) → VARCHAR sql
| Parameter | Type | Required | Description |
|---|---|---|---|
string | VARCHAR | Yes | String to trim |
characters | VARCHAR | No | Characters to remove from the end (optional; default trims whitespace) |
Notes
- Removes trailing whitespace only (spaces, tabs, line breaks, and similar) when
charactersis omitted - With
characters, removes trailing code points that appear in that string - Leading and internal whitespace are unchanged
RTRIM('')is''; if the input is NULL the result is NULL (useNULL(VARCHAR); bareNULLfails inference)
Examples
FeatureQL
SELECT
-- Trim right only
f1 := RTRIM(' hello '),
-- Trim tab from right
f2 := RTRIM(' world '),
-- Only right trim
f3 := RTRIM(' mixed spaces '),
-- No right whitespace
f4 := RTRIM('no trim needed'),
-- NULL yields NULL
f5 := RTRIM(NULL(VARCHAR)),
-- Trim custom characters
f6 := RTRIM('helloxx', '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