Skip to main content
Version: V1.1.0

INSTR

Declaration

INSTR(str,substr)

Description

Returns the first occurrence of a substring in the string str. This is equivalent to the two-argument form of LOCATE() with the arguments reversed.

Examples

SELECT INSTR('foobarbar', 'bar'), INSTR('xbar', 'foobar');
+---------------------------+-------------------------+
| INSTR('foobarbar', 'bar') | INSTR('xbar', 'foobar') |
+---------------------------+-------------------------+
| 4 | 0 |
+---------------------------+-------------------------+
1 row in set (0.001 sec)