zoukankan      html  css  js  c++  java
  • Mysql函数->TRIM(去掉首尾空格、任意字符)

    TRIM

    语法

    TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str)

    序号 函数                                                  函数结果       备注
    1 trim(' test ') 'test' 删除字符串前后空格
    2 trim(both from ' test ') 'test' 'both'参数表示同时去除字符串前后所指定的内容(默认情况下删除空格)
    3 trim(trailing from ' test ') ' test' 'trailing'参数表示删除字符串尾部空格
    4 trim(leading from ' test ') 'test ' 'leading'参数表示删除字符串头部空格
    5 trim('x' from 'xxxtestxxx') 'test' 删除字符串前后的字符'x' 
    6 trim(both 'x' from 'xxxtestxxx') 'test' 删除字符串前后的字符'x'
    7 trim(trailing 'xy' from  'xyxyxtestxxyxy') 'xyxyxtestx' 删除字符串尾部的字符串'xy'
    8 trim(leading 'xy' from 'xyxyxtestxxyxy') 'xtestxxyxy' 删除字符串头部的字符串'xy'
    9 trim(leading 'xy' from trim(trailing 'xy' from  'xyxtestxxy')) 'xtestx' 删除字符串头尾的字符'xy'

    LTRIM / RTRIM 

    去掉字符串左/右边的空格

    序号 函数                         函数结果     备注                              
    1 ltrim(' test ') 'test ' 去掉字符串左边的空格
    2 rtrim(' test ') ' test' 去掉字符串右边的空格
    3      
    作者:小念
    本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。
  • 相关阅读:
    今天冷兔上线.
    tweenlite
    AS3中对String操作的replaceAll方法
    咫尺天涯的幸福
    ESPCMS系统模板结构图
    [转]AIR中调用exe或者bat可执行文件
    摘自《做人还是现实些》
    framespacing="10"和border="10"在frameSet中有什么区别?
    一个简单的div与span例子
    理解Javascript_05_原型继承原理 ,转载文章
  • 原文地址:https://www.cnblogs.com/kiko2014551511/p/14464191.html
Copyright © 2011-2022 走看看