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 |
+------+