Skip to main content

STRPOS

Returns the index position of substring in string, or 0 if the substring isn't found. If the optional argument start is added, the function ignores any instances of substring that appear before the index position start.

Syntax​

STRPOS ( string_expression, substring [, start_pos] ) 

Arguments​

string_expression
A valid string expression.

substring A string expression that may be contained in string_expression.

start_pos The position to start reading from as a numeric value.

Return Type​

Returns an INT64.

Examples​

Examples in this section use the example blockchain.

The following example checks whether "d" is contained within each str record.

SELECT STRPOS(str, "ec", 3) FROM example;

Response:

SELECT STRPOS(str, "ec", 3) [STRING]
NULL
0
0
5