LTRIM
Descriptionβ
The LTRIM function is used to remove consecutive spaces or specified characters from the left side (leading) of a string.
Syntaxβ
LTRIM( <str> [, <trim_chars> ] )
Parametersβ
Parameter | Description |
---|---|
<str> | String that need to be trimmed |
<trim_chars> | Optional Parameter. If this parameter is provided, the LTRIM function will remove all characters from the <trim_chars> that appear on the left side of <str> . If this parameter is not provided, the LTRIM function will only remove the space character to the left of '<str>' . |
Return Valueβ
Returns a string with leading spaces or <trim_chars>
removed. Special cases:
- If any Parameter is NULL, NULL will be returned.
Examplesβ
SELECT ltrim(' ab d') str;
+------+
| str |
+------+
| ab d |
+------+
SELECT ltrim('ababccaab','ab') str;
+-------+
| str |
+-------+
| ccaab |
+-------+