Sqlite Ltrim Function

SQLite: ltrim Function

This SQLite post 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.

Note

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('   AODBA.com');
Output: 'AODBA.com'

sqlite> SELECT ltrim('   AODBA.com   ');
Output: 'AODBA.com   '

sqlite> SELECT ltrim('   AODBA.com    is great!');
Output: 'AODBA.com    is great!'

sqlite> SELECT ltrim('000123', '0');
Output: '123'

sqlite> SELECT ltrim('123123dbd', '123');
Output: 'dbd'

sqlite> SELECT ltrim('123123dbd123', '123');
Output: 'dbd123'

sqlite> SELECT ltrim('6372dbd', '0123456789');
Output: 'dbd'