SQLite ltrim()
function returns a copy of a string that has been removed of any prefix that contains specified characters.
Syntax
ltrim(string,[character])
Code language: SQL (Structured Query Language) (sql)
Arguments
The ltrim()
function accepts two arguments:
string
The source string
character
The character is an optional argument. If you specify it, the ltrim()
function will remove all the characters at the beginning of the string. If you omit the character argument, the ltrim()
function will remove the spaces at the beginning of the string.
Return Type
TEXT
Examples
The following statement returns a string with spaces at the beginning of the string removed.
SELECT ltrim(' SQLite');
Code language: SQL (Structured Query Language) (sql)
ltrim(' SQLite') ----------------- SQLite
The following statement removes the @ character at the beginning of the string. Notice that the @ characters at the middle and the end of the string remain intact.
SELECT ltrim('@@@SQLite@ltrim@', '@');
Code language: SQL (Structured Query Language) (sql)
ltrim('@@@SQLite@ltrim@', '@') ------------------------------- SQLite@ltrim@