Product Site

5.1.7.45. caselessPos

Returns the position in the receiving string of another string, needle. It returns 0 if needle is the null string or is not found or if start is greater than the length of the receiving string. The search is performed using caseless comparisons. By default, the search starts at the first character of the receiving string (that is, the value of start is 1), and continues to the end of the string. You can override this by specifying start, the point at which the search starts, and length, the bounding limit for the search. If specified, start must be a positive whole number and length must be a non-negative whole number.

See also methods pos and caselessLastPos.
Example 5.84. String class — caselessPos method
"Saturday"~caselessPos("DAY")       -->    6
"abc def ghi"~caselessPos("x")      -->    0
"abc def ghi"~caselessPos(" ")      -->    4
"abc def ghi"~caselessPos(" ",5)    -->    8
"abc def ghi"~caselessPos(" ",5,3)  -->    0