SQLite Rtrim

SQLite rtrim() function returns a copy of a string that has been removed of any suffix that consists of specified characters.

Syntax

rtrim(string,[character])Code language: SQL (Structured Query Language) (sql)

Arguments

The rtrim() function accepts two arguments:

string

The source string

character

The character is an optional argument. If you don’t specify it, it is assumed to be a space character, and the  rtrim() function will remove all space characters at the end of the string.

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

Return Type

TEXT

Examples

The following statement returns a string with the space characters at the end of the string removed.

SELECT rtrim('SQLite   ');Code language: SQL (Structured Query Language) (sql)
rtrim('SQLite   ')
-----------------
SQLite

The following statement removes all the $ characters at the end of the string. Notice that the $ characters at the beginning and middle of the string remain intact.

SELECT rtrim('$SQLite$rtrim$$$$','$');Code language: SQL (Structured Query Language) (sql)
rtrim('$SQLite$rtrim$$$$','$')
-------------------------------
$SQLite$rtrim

See Also

trimltrim

Was this tutorial helpful ?