SQLite rtrim() function

Savigo
You organize your data. Now organize your savings.
Set savings goals, track your progress, and stay on course.
Get Savigo for iPhone 

SQLite rtrim() function removes trailing spaces or specified characters from a string. It returns a new copy of the input string with the trailing characters removed.

Syntax #

rtrim(string,[character])

Arguments #

The rtrim() function accepts two arguments:

string

The input string that you want to remove the characters.

character

The character string that you want to remove from the input string. It is optional.

If you don’t specify it, it is assumed to be a space character and the  rtrim() function will remove all trailing space from the input string.

If you explicitly specify the characters you want to remove, the rtrim() function will remove all the specified characters at the end of the string.

Return Type #

TEXT

Examples #

The following statement uses the rtrim() function to remove trailing spaces from a string:

SELECT rtrim('SQLite   ') result;

Output:

result
------
SQLite

The following statement uses the rtrim() function to the USD from an amount:

SELECT rtrim('500USD', 'USD') amount;

Output:

amount
------
500

See Also #

trimltrim

Was this tutorial helpful?