MYSQL数据库mysql trim函数用法实例
《MYSQL数据库mysql trim函数用法实例》要点: 一,mysql去除左空格函数: 例子: -> 'barbar' this function is multi-byte safe. 二,mysql去除右空格函数: 例子: mysql> select rtrim('barbar?? '); this function is multi-byte safe.MYSQL数据库 三,trim函数可以过滤指定的字符串: returns the string str with all remstr prefixes or suffixes removed. if none of the specifiers both,leading,or trailing is given,both is assumed. remstr is optional and,if not specified,spaces are removed.MYSQL数据库 例子: -> 'bar' mysql> select trim(leading ',' from ',barxxx'); //删除指定首字符 如’,‘ -> 'barxxx' mysql> select trim(both ',bar,');? //删除指定首尾字符 -> 'bar' mysql> select trim(trailing ',' from 'barxxyz,'); -> 'barxxyz' ? mysql> select trim(' bar?? '); //默认删除前后空格 -> 'bar' mysql> select trim(leading ',barxxx');? //删除指定首字符 如’,'); -> 'barxxyz' ? mysql> update table set `field`=trim(trailing ',' from `field`) where where `field` like '%,'; this function is multi-byte safe. mysql trim函数清除字段两边的空格: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |