时间:2024-02-21 13:55作者:下载吧人气:27
postgresql中将数字转换为字符串前面莫名期末的多出一个空格,
例如:
前面加上fm就可以去掉空格了,如下
补充:postgresql去掉字符串空白符以及首尾空格
我就废话不多说了,大家还是直接看代码吧~
–去除空白符
select regexp_replace(‘ a s d
‘, E’\s+’, ‘ ‘, ‘g’)
–去除首空格
select regexp_replace(‘ a b d ‘,E'(^\s*)’,”,’g’)
–去除尾空格
select regexp_replace(‘ a b d ‘,E'(\s*$)’,”,’g’)
–去除首尾空格
select regexp_replace(‘ a b d ‘,E'(^\s*)|(\s*$)’,”,’g’)
–去除首尾空格的函数
select trim(‘ a b d ‘)
网友评论