Skip to main content
Returns the position of the substring found in the string, starting from 1. The returned value is for the first matching value, and not for any subsequent valid matches. In case the substring does not exist, functions will return 0.

Syntax

STRPOS(<string>, <substring>)

Parameters

ParameterDescriptionSupported input types
<string>The string that will be searched.TEXT
<substring>The substring to search for.TEXT

Return Type

INTEGER

Examples

SELECT STRPOS('hello world', 'hello') AS res;
res int
1

Rows: 1Execution time: 4.90ms

SELECT STRPOS('hello world', 'world') AS res;
res int
7

Rows: 1Execution time: 5.18ms

SELECT STRPOS('hello world', 'work') AS res;
res int
0

Rows: 1Execution time: 6.18ms