SQLite 3 reference · String Functions

SQLite RTRIM() Function

Remove spaces, or characters you list, from the end (right side) of a string only.

SQLite 3

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

rtrim(X, Y)

Parameters

ParameterDescription
X The string (other values are converted to text).
Y optional The characters to remove; spaces by default.

Return value

The string without trailing characters.

Examples

Trailing spacesTry it yourself
SELECT '[' || rtrim('right   ') || ']' AS result;

Output

result
[right]
Trailing slashesTry it yourself
SELECT rtrim('https://example.com///', '/') AS url;

Output

url
https://example.com

In other languages

Was this page helpful?