FIND_IN_SET Function
Description
strlist is a string composed of N substrings separated by ,. If the string str is present in strlist, returns the position of str (between 1 and N).
If str is not in strlist or strlist is an empty string, returns 0.
Parameters
str: STRING type, the string to search for.strlist: STRING type, a comma-separated list of strings.
Returns
INT type. Returns the position of str in strlist (1-based), or 0 if not found.
Examples
-
Basic usage:
-
Returns 0 when not found:
-
Supports Unicode characters:
Notes
- Returns NULL when any parameter is NULL.
- This function will not work correctly when the first argument
strcontains a comma,. - Returns 0 when
stris an empty string.
