# Find A String In A String
__*INSTR function*__
__*LOCATE function*__
__*POSITION function*__
+ `INSTR(), LOCATE(), POSITION()`: return the position of the specified string in another string
  + For example: `select instr('TiDB','DB'), instr('TiDB','D'), locate('DB', 'TiDB'), position('DB' in 'TiDB');`  
+ `LOCATE(searchstr、str、pos)`: where pos specifies the starting position of the search:
  + For example: `select locate('DB', 'TiDB is a NewSQL style DB', 7);`  
```
tidb> SELECT instr('TiDB','DB'), instr('TiDB','D'), locate('DB', 'TiDB'), position('DB' in 'TiDB');
+--------------------+-------------------+----------------------+--------------------------+
| instr('TiDB','DB') | instr('TiDB','D') | locate('DB', 'TiDB') | position('DB' in 'TiDB') |
+--------------------+-------------------+----------------------+--------------------------+
|                  3 |                 3 |                    3 |                        3 |
+--------------------+-------------------+----------------------+--------------------------+
1 row in set (0.00 sec)
tidb> SELECT locate('~!@DB@!~', 'TiDB is a NewSQL style DB', 7);
+----------------------------------------------+
| locate('DB', 'TiDB is a NewSQL style DB', 7) |
+----------------------------------------------+
|                                           ~!@24@!~ |
+----------------------------------------------+
1 row in set (0.00 sec)
```

------------------------------------------------------------
- `INSTR()`  return the index of the first occurrence of the substring
- `LOCATE()/POSITION()`  return position of the first occurrence of the substring
