PostgreSQL LTRIM() function
LTRIM() function
The PostgreSQL ltrim() function is used to remove spaces ( if no character(s) is provided as trimming_text ) or set of characters which are matching with the trimming_text, from the start of a string.
Syntax:
ltrim(<string>[, <triming_text>])
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL LTRIM() function
Example: PostgreSQL ltrim() function:
In the example below, the statement returns the result 'ltrim'. Here in the example the trimming_text is provided, and it is 'best', and the left four characters i.e. 'test' have removed and the characters 't' and 'e' and 's' are present in the trimming_text 'best'.
Code:
SELECT ltrim('testltrim', 'best');
Sample Output:
ltrim ------- ltrim (1 row)
Example of PostgreSQL ltrim() function with no text:
In the example below, the trimming_text is not provided, so by default the white spaces from the left side of the given string will be removed.
Code:
SELECT ltrim(' ltrim');
Sample Output:
ltrim ------- ltrim (1 row)
Previous: LPAD function
Next: PG_CLIENT_ENCODING function
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework