string-compare-ignore-case
The string-compare-ignore-case function (see screenshot below) returns the result of a character by character comparison of two input strings: string1 and string2. Both string1 and string2 are of type xs:string. The function ignores case. The comparison is based on the ASCII codes. If the strings are equal, the result is 0. If string1 is less than string2, the result is -1. If string1 is greater than string2, the result is 1.
Example:
string1: hi
string2: Hit
The string-compare-ignore-case function compares the strings character by character. Even though h is represented as a bigger ASCII code number than H, these two characters are treated as equal in this function. The second character in both strings is the same. However, string2 has a third character, whereas string1 does not. The third character in string1 has an empty value. The t value in string2 is greater than the empty value in string1. Therefore, string1 is less than string2, and the result equals -1.
Languages
Built-in, C++, C#, Java.
Parameters
Name | Type | Description |
---|---|---|
string1 | xs:string | The first input string. |
string2 | xs:string | The second input string. |