indexof()

Returns the position of the first occurrence of the specific pattern in the specified string. It returns -1 if the pattern is not found, and null if the string or the pattern to be matched in the string is null.

Syntax

indexof(STR_EXPR, SEARCH_EXPR[, BEGIN_EXPR])
Required Parameters
STR_EXPR
String expression.
SEARCH_EXPR
String to be checked if it is included in the string value of STR_EXPR.
Optional Parameters
BEGIN_EXPR
Position index to start searching. The index indicating the position starts with 0. The function finds the SEARCH_EXPR value from the specified position.

Usage

indexof("hello world", "world") => 6
indexof("hello world", "foo") => -1
indexof("hello world", null) => null
indexof(null, "world") => null
indexof(null, null) => null
indexof("hello world", "o", 5) => 7