avatar

mysql 的一些函数简介

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1. substring_index(str,delim,count)

**      str:要处理的字符串**

**      delim:分隔符**

**      count:计数**
例子:str=www.baidu.com

      substring_index(str,'.',1)

      结果是:www

      substring_index(str,'.',2)

      结果是:www.baidu

      也就是说,如果count是正数,那么就是从左往右数,第N个分隔符的左边的全部内容

      相反,如果是负数,那么就是从右边开始数,第N个分隔符右边的所有内容,如:

      substring_index(str,'.',-2)
2.
文章作者: 无知的小狼
文章链接: https://bytedance.press/2019/07/05/articles/2019/07/05/1562298048216.html/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 无知的小狼

评论