《MYSQL數據庫mysql trim函數用法舉例》要點:
本文介紹了MYSQL數據庫mysql trim函數用法舉例,希望對您有用。如果有疑問,可以聯系我們。
mysql中去除左空格函數:
?MYSQL入門
例子:
?MYSQL入門
mysql中去除右空格函數:
?MYSQL入門
例3:
?MYSQL入門
this function is multi-byte safe.MYSQL入門
trim函數可以過濾指定的字符串:
完整格式:trim([{both | leading | trailing} [remstr] from] str)
簡化格式:trim([remstr from] str)MYSQL入門
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入門
mysql trim函數的例子:
?MYSQL入門
mysql> select trim(' bar?? '); //默認刪除前后空格
-> 'bar'
mysql> select trim(leading ',' from ',,barxxx'); //刪除指定首字符 如’,‘
-> 'barxxx'
mysql> select trim(both ',' from ',,bar,,,');? //刪除指定首尾字符
-> 'bar'
mysql> select trim(trailing ',' from 'barxxyz,,');
-> 'barxxyz'MYSQL入門
mysql> update table set `field`=trim(trailing ',' from `field`) where where `field` like '%,';
this function is multi-byte safe.MYSQL入門
維易PHP培訓學院每天發布《MYSQL數據庫mysql trim函數用法舉例》等實戰技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養人才。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/7410.html