trim

description

Syntax

VARCHAR trim(VARCHAR str[, VARCHAR rhs])

When the ‘rhs’ parameter is not present, remove the continuous spaces that appear from the starting and ending of the ‘str’ parameter. Otherwise, remove ‘rhs’.

example

  1. mysql> SELECT trim(' ab d ') str;
  2. +------+
  3. | str |
  4. +------+
  5. | ab d |
  6. +------+
  7. mysql> SELECT trim('ababccaab','ab') str;
  8. +------+
  9. | str |
  10. +------+
  11. | cca |
  12. +------+

keywords

  1. TRIM