pos()

Read(436) Label: parent string, substring, position,

Description:

Get the position of a substring in its parent string.

Syntax:

pos(s1, s2{, begin})

Note:

The function finds the position of substring s2 in the parent string s1, which starts from the position begin, and returns null if the substring cannot be found.

Parameters:

s1

The parent string where you want to search for the substring.

s2

Substring of interest.

begin

The position from which the search starts; the default search is from the beginning.

Options:

@z

Perform the search leftward starting from begin, while the search will be done rightward by default.

@c

Case-insensitive

@h

Search for the subsring at the beginning of the parent string by ignoring parameter begin

Return value:

Integer type

Example:

pos("abcdef","def")

4

pos("abcdefdef","def",5)

7

pos("abcdef","defa")

(null)

pos@z("abcdeffdef","def",7)

pos("abcdeffdef","def",7)

4

8

pos@c("abcdef","Def")

4; @c option makes case-insensitive