Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function

position — find position of a substring

Synopsis

position(s: string, sub: string) -> int64
position(sub: string IN s:string) -> int64

Description

The position function returns the 1-based index where string sub first occurs in string s. If sub is not a sub-string of s then 0 is returned.

Examples


# spq
values position(s, sub)
# input
{s:"foobar",sub:"bar"}
# expected output
4