Product Site

5.1.7.43. caselessMatch

Returns .true if the characters of the other match the characters of the target string beginning at position start. Returns .false if the characters are not a match. The matching is performed using caseless comparisons. start must be a positive whole number.

If n is specified, the match will be performed starting with character n of other. The default value for n is "1". n must be a positive whole number less than or equal to the length of other.

If length is specified, it defines a substring of other that is used for the match. length must be a positive whole number and the combination of n and length must be a valid substring within the bounds of other.

The caselessMatch method is useful for efficient string parsing as it does not require new string objects be extracted from the target string.
Example 5.82. String class — caselessMatch method
"Saturday"~caselessMatch(6, "day")           -->    1
"Saturday"~caselessMatch(6, "DAY")           -->    1
"Saturday"~caselessMatch(6, "SUNDAY", 4, 3)  -->    1
"Saturday"~caselessMatch(6, "daytime", 1, 3) -->    1