POS (Position)

The POS function returns the position of one string, needle, in another, haystack.

Read syntax diagramSkip visual syntax diagram POS( needle , haystack ,start )

POS returns 0 if needle is the null string or is not found or if start is greater than the length of haystack. By default the search starts at the first character of haystack (that is, the value of start is 1). You can override this by specifying start (which must be a positive whole number), the point at which the search starts. See also the INDEX and LASTPOS functions, INDEX and LASTPOS (Last Position).

Examples

POS('day','Saturday')       ->    6
POS('x','abc def ghi')      ->    0
POS(' ','abc def ghi')      ->    4
POS(' ','abc def ghi',5)    ->    8