INDEX(…string-expr…, …char-expr…)
INDEX FROM START(…string-expr…, …char-expr…)
INDEX FROM END(…string-expr…, …char-expr…)
STRING -> CHAR -> BOOL
Returns the position of the first (or last) occurrence of the given character in the given string.
The position of the first character is 0.
Notice that the search is case sensitive.
If the character is not present in the string then -1 is returned
expression | evaluates to |
---|---|
INDEX("foobar", #\o) | 1 |
INDEX("foobar", #\O) | -1 |
INDEX FROM END("foobar", #\o) | 2 |