時間:2024-02-21 13:55作者:下載吧人氣:22
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 ‘)
網友評論