SQLite: rtrim Function
This SQLite tutorial explains how to use the SQLite rtrim function with syntax and examples.
Description
The SQLite rtrim function removes all specified characters from the right-hand side of a string.
Syntax
The syntax for the rtrim function in SQLite is:
rtrim( string, [ trim_string ] )
Parameters or Arguments
- string
- The string to trim the characters from the right-hand side.
- trim_string
- The string that will be removed from the right-hand side of string. If this parameter is omitted, the rtrim function will remove all trailing spaces from string.
Applies To
The rtrim function can be used in the following versions of SQLite:
- SQLite 3.8.6, SQLite 3.8.x, SQLite 3.7.x, SQLite 3.6.x
Example
Let's look at some SQLite rtrim function examples and explore how to use the rtrim function in SQLite.
For example:
sqlite> SELECT rtrim('TechOnTheNet.com '); Result: 'TechOnTheNet.com' sqlite> SELECT rtrim(' TechOnTheNet.com '); Result: ' TechOnTheNet.com' sqlite> SELECT rtrim('TechOnTheNet.com is great! '); Result: 'TechOnTheNet.com is great!' sqlite> SELECT rtrim('123000', '0'); Result: '123' sqlite> SELECT rtrim('totn123123', '123'); Result: 'totn' sqlite> SELECT rtrim('123totn123123', '123'); Result: '123totn' sqlite> SELECT rtrim('TOTNxyxzyyy', 'xyz'); Result: 'TOTN' sqlite> SELECT rtrim('totn6372', '0123456789'); Result: 'totn'
Advertisements