Functions Index :: S :: StrFind

[<< up one level]

Module:

string :: search

Definition:

StrFind(string base, string sought, int "index", bool "ignorecase")

Description:

A generic substring search function that can return all positions of occurrence of sought inside base (as an array) or a specific occurrence (as a zero-based index of the array).

Both case-sensitive and case-insensitive searches are supported, controlled by the ignorecase argument.

Notes and conditions on arguments relations:

1] The function defaults to case-sensitive searches and to returning all positions of sought. If only the first occurence is wanted the index argument must explicilty contain a zero value.

Examples:

a1 = StrFind("abbcdefabcd", "b")

a1 == "2,3,9" (an array)

a2 = StrFind("abbcdefabcd", "B")

a2 == 0 (case-sensitive is the default)

a3 = StrFind("abbcdefabcd", "b", 0)

a3 == 2

 

[<< top]