Home > Database > Mysql Tutorial > body text

MySQL查找某个字符的位置、截取、长度_MySQL

WBOY
Release: 2016-06-01 13:06:03
Original
2144 people have browsed it

使用MySQL,我们很多时候都会出现需要截取字符串的情况,所以关于字符串的截取的方式有必要记录下去。

 MySQL截取字符串的函数有:

        left(str, length):从左边开始截取,length是截取的长度。

        right(str,length):同上,不过方向相反

        substring(str,pos,[length])

如果是substring(str,pos)函数,我可能要使用查找字符串中某个字符的位置问题。所有就要使用

        locate(search,str):返回search在str的位置

最后,获取长度的函数是length(str):返回str的长度。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template