Product Site

5.1.7.36. caselessCompareTo

Performs a caseless sort comparison of the target string to the string argument. If the two strings are equal, 0 is returned. If the target string is larger, 1 is returned. -1 if the string argument is the larger string. The comparison is performed starting at character n for length characters in both strings. n must be a positive whole number. If n is omitted, the comparison starts at the first character. length must be a non-negative whole number. If omitted, the comparison will take place to the end of the target string.
Example 5.76. String class — caselessCompareTo method
Say "abc"~caselessCompareTo("abc")         -->    0
Say "b"~caselessCompareTo("a")             -->    1
Say "a"~caselessCompareTo("b")             -->   -1
Say "abc"~caselessCompareTo("aBc")         -->    0
Say "aBc"~caselessCompareTo("abc")         -->    0
Say "000abc000"~caselessCompareTo("111abc111", 4, 3)  --> 0