- (string-compare s1 s2 proc< proc= proc> [start1 end1 start2 end2]) -> valuesprocedure
- (string-compare-ci s1 s2 proc< proc= proc> [start1 end1 start2 end2]) -> valuesprocedure
Apply PROC<, PROC=, or PROC> to the mismatch index, depending upon whether S1 is less than, equal to, or greater than S2. The "mismatch index" is the largest index I such that for every 0 <= J < I, S1[J] = S2[J] -- that is, I is the first position that doesn't match.
string-compare-ci is the case-insensitive variant. Case-insensitive comparison is done by case-folding characters with the operation
(char-downcase (char-upcase C))
where the two case-mapping operations are assumed to be 1-1, locale- and context-insensitive, and compatible with the 1-1 case mappings specified by Unicode's UnicodeData.txt table:
The optional start/end indices restrict the comparison to the indicated substrings of S1 and S2. The mismatch index is always an index into S1; in the case of PROC=, it is always END1; we observe the protocol in this redundant case for uniformity.
(string-compare "The cat in the hat" "abcdefgh" values values values 4 6 ; Select "ca" 2 4) ; & "cd" => 5 ; Index of S1's "a"
Comparison is simply done on individual code-points of the string. True text collation is not handled by this SRFI.