跳到主要内容

TRIM

描述

当没有 rhs 参数时,将参数 str 中右侧和左侧开始部分连续出现的空格去掉;当有 rhs 参数时,在字符串的两端查找并移除 rhs 字符集合中的任何字符(不考虑顺序)

语法

TRIM_IN( <str> [ , <rhs>])

必选参数

参数描述
<str>删除该字符串两端的空格

可选参数

参数描述
<rhs>去掉该指定字符

返回值

删除两端的空格或指定字符后的字符串

举例

SELECT trim_in('   ab d   ') str;
+------+
| str |
+------+
| ab d |
+------+
SELECT trim_in('ababccaab','ab') str;
+------+
| str |
+------+
| cc |
+------+