TRIM
Descriptionβ
This command is used to delete Spaces or specified characters at both ends of the string. If no rhs parameter is specified, delete the Spaces that appear continuously at the beginning of the right and left parts of str. Otherwise, delete rhs
Syntaxβ
TRIM( <str> [ , <rhs>])
Required Parametersβ
Parameters | Description |
---|---|
<str> | Deletes the Spaces at both ends of the string |
Optional Parametersβ
Parameters | Description |
---|---|
<rhs> | removes the specified character |
Return Valueβ
Deletes Spaces at both ends or the string after a specified character
Exampleβ
SELECT trim(' ab d ') str;
+------+
| str |
+------+
| ab d |
+------+
SELECT trim('ababccaab','ab') str;
+------+
| str |
+------+
| cc |
+------+