数据仓库服务 GAUSSDB(DWS)-字符处理函数和操作符:trim([leading |trailing |both] [characters] from string)

时间:2024-11-28 17:38:52

trim([leading |trailing |both] [characters] from string)

描述:从字符串string的开头、结尾或两边删除只包含characters中字符(缺省是一个空白)的最长的字符串。

返回值类型:varchar

示例:

1
2
3
4
5
SELECT trim(BOTH 'x' FROM 'xTomxx');
 btrim
-------
 Tom
(1 row)
1
2
3
4
5
SELECT trim(LEADING 'x' FROM 'xTomxx');
 ltrim
-------
 Tomxx
(1 row)
1
2
3
4
5
SELECT trim(TRAILING 'x' FROM 'xTomxx');
 rtrim
-------
 xTom
(1 row)
support.huaweicloud.com/sqlreference-830-dws/dws_06_0030.html
推荐文章