postgresql去掉字符串空白符以及首尾空格

前端之家收集整理的这篇文章主要介绍了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 ')
原文链接:https://www.f2er.com/postgresql/193928.html

猜你在找的Postgre SQL相关文章