mysql有三个函数判断字符串在另一个字符串中是否存在:
locate(substr, str),position(substr IN str),instr(str, substr)
这三个函数基本上没什么区别,都是返回子串在父串中出现的位置。
需要注意的是locate函数和instr函数子串和父串参数的位置。
locate函数还支持第三个函数,locate(substr,str, n) ,返回子串在父串中在第n个字符后第一次出现的位置。
mysql有三个函数判断字符串在另一个字符串中是否存在:
locate(substr, str),position(substr IN str),instr(str, substr)
这三个函数基本上没什么区别,都是返回子串在父串中出现的位置。
需要注意的是locate函数和instr函数子串和父串参数的位置。
locate函数还支持第三个函数,locate(substr,str, n) ,返回子串在父串中在第n个字符后第一次出现的位置。