Skip to main content

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

ParametersDescription
<str>Deletes the Spaces at both ends of the string

Optional Parameters

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