SQLite: ltrim Function
This SQLite tutorial explains how to use the SQLite ltrim function with syntax and examples.
Description
The SQLite ltrim function removes all specified characters from the left-hand side of a string.
Syntax
The syntax for the ltrim function in SQLite is:
ltrim( string, [ trim_string ] )
Parameters or Arguments
- string
- The string to trim the characters from the left-hand side.
- trim_string
- The string that will be removed from the left-hand side of string. If this parameter is omitted, the ltrim function will remove all leading spaces from string.
Applies To
The ltrim 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 ltrim function examples and explore how to use the ltrim function in SQLite.
For example:
sqlite> SELECT ltrim(' TechOnTheNet.com'); Result: 'TechOnTheNet.com' sqlite> SELECT ltrim(' TechOnTheNet.com '); Result: 'TechOnTheNet.com ' sqlite> SELECT ltrim(' TechOnTheNet.com is great!'); Result: 'TechOnTheNet.com is great!' sqlite> SELECT ltrim('000123', '0'); Result: '123' sqlite> SELECT ltrim('123123totn', '123'); Result: 'totn' sqlite> SELECT ltrim('123123totn123', '123'); Result: 'totn123' sqlite> SELECT ltrim('xyxzyyyTOTN', 'xyz'); Result: 'TOTN' sqlite> SELECT ltrim('6372totn', '0123456789'); Result: 'totn'
Advertisements