富贵资源网 Design By www.hznty.com
mysql中的去除左空格函数:
LTRIM(str)
Returns the string str with leading space characters removed.
以下是代码片段:
复制代码 代码如下:
mysql> SELECT LTRIM(' barbar');
-> 'barbar'
This function is multi-byte safe.
mysql中的去除右空格函数:
RTRIM(str)
Returns the string str with trailing space characters removed.
以下是代码片段:
复制代码 代码如下:
mysql> SELECT RTRIM('barbar ');
-> 'barbar'
This function is multi-byte safe.
trim函数可以过滤指定的字符串:
完整格式:TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str)
简化格式:TRIM([remstr FROM] str)
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> 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> UPDATE table SET `field`=TRIM(TRAILING ',' FROM `FIELD`) WHERE WHERE `FIELD` LIKE '%,';
This function is multi-byte safe.
替换数据库中字段的最后一个分页符
复制代码 代码如下:
UPDATE [!db.pre!]ecms_news_data_1 SET `newstext`=TRIM(TRAILING '[!--empirenews.page--]' FROM `newstext`) WHERE id=585;
SELECT TRIM(TRAILING '[!--empirenews.page--]' FROM `newstext`) AS newstex FROM [!db.pre!]ecms_news_data_1 WHERE id=585;
LTRIM(str)
Returns the string str with leading space characters removed.
以下是代码片段:
复制代码 代码如下:
mysql> SELECT LTRIM(' barbar');
-> 'barbar'
This function is multi-byte safe.
mysql中的去除右空格函数:
RTRIM(str)
Returns the string str with trailing space characters removed.
以下是代码片段:
复制代码 代码如下:
mysql> SELECT RTRIM('barbar ');
-> 'barbar'
This function is multi-byte safe.
trim函数可以过滤指定的字符串:
完整格式:TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str)
简化格式:TRIM([remstr FROM] str)
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> 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> UPDATE table SET `field`=TRIM(TRAILING ',' FROM `FIELD`) WHERE WHERE `FIELD` LIKE '%,';
This function is multi-byte safe.
替换数据库中字段的最后一个分页符
复制代码 代码如下:
UPDATE [!db.pre!]ecms_news_data_1 SET `newstext`=TRIM(TRAILING '[!--empirenews.page--]' FROM `newstext`) WHERE id=585;
SELECT TRIM(TRAILING '[!--empirenews.page--]' FROM `newstext`) AS newstex FROM [!db.pre!]ecms_news_data_1 WHERE id=585;
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...