PostgreSQL 18 reference · String Functions
PostgreSQL LTRIM() Function
Remove spaces, or characters you list, from the start of a string only.
PostgreSQL 18
Syntax
ltrim(string, characters)
Parameters
| Parameter | Description |
|---|---|
string |
The input text. |
characters optional |
Characters to remove; spaces by default. |
Return value
Text.
Examples
SELECT '[' || ltrim(' left') || ']' AS result;
Output
result -------- [left] (1 row)
Run this on your computer — see “Get Started” for setup.
SELECT ltrim('xxyHello', 'xy') AS result;
Output
result -------- Hello (1 row)
Run this on your computer — see “Get Started” for setup.
In other languages
LTRIM()· SQLite
Related
TRIM()· Remove spaces, or characters you list, from the start, end or both ends of a string. btrim() is the function form.RTRIM()· Remove spaces, or any characters you list, from the end (right side) of a string only.- SQL String Functions · tutorial