TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str) : TRIM « String Functions « MySQL Tutorial






Returns the string str with all remstr prefixes or suffixes removed.

If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed.

remstr is optional and, if not specified, spaces are removed.

mysql>
mysql>
mysql> SELECT TRIM('  java2s   ');
+---------------------+
| TRIM('  java2s   ') |
+---------------------+
| java2s              |
+---------------------+
1 row in set (0.00 sec)

mysql>








23.44.TRIM
23.44.1.TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str)
23.44.2.TRIM(LEADING 'x' FROM 'xxxhava2sxxx');
23.44.3.TRIM(BOTH 'x' FROM 'xxxjava2sxxx');
23.44.4.TRIM(TRAILING 'xyz' FROM 'java2sxxyz');
23.44.5.The TRIM() function can trim spaces and characters or groups of characters.
23.44.6.SELECT TRIM(LEADING 'XXX' FROM 'XXXFileName')
23.44.7.If you wanted to trim leading and trailing characters, you would use the keyword BOTH