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

时间:2025-08-28 15:00:54

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

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

返回值类型:text。

示例:

1
2
3
4
5
gaussdb=# SELECT trim(BOTH 'x' FROM 'xTomxx');
 btrim
-------
 Tom
(1 row)
1
2
3
4
5
gaussdb=# SELECT trim(LEADING 'x' FROM 'xTomxx');
 ltrim
-------
 Tomxx
(1 row)
1
2
3
4
5
gaussdb=# SELECT trim(TRAILING 'x' FROM 'xTomxx');
 rtrim
-------
 xTom
(1 row)
support.huaweicloud.com/centralized-devg-v8-gaussdb/gaussdb-42-1838.html
推荐文章