Node:SRFI13 Comparison,
Next:SRFI13 Prefixes/Suffixes,
Previous:SRFI13 Modification,
Up:SRFI13
39.11.7 Comparison
The procedures in this section are used for comparing strings in
different ways. The comparison predicates differ from those in R5RS in
that they do not only return #t
or #f
, but the mismatch
index in the case of a true return value.
stringhash
and stringhashci
are for calculating hash
values for strings, useful for implementing fast lookup mechanisms.
stringcompare s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2]

Scheme Procedure 
stringcompareci s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2]

Scheme Procedure 
Apply proc_lt, proc_eq, proc_gt 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 does not match. The
character comparison is done caseinsensitively.

string= s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
string<> s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
string< s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
string> s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
string<= s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
string>= s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
Compare s1 and s2 and return #f if the predicate
fails. Otherwise, the mismatch index is returned (or end1 in the
case of string= .

stringci= s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
stringci<> s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
stringci< s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
stringci> s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
stringci<= s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
stringci>= s1 s2 [start1 end1 start2 end2]

Scheme Procedure 
Compare s1 and s2 and return #f if the predicate
fails. Otherwise, the mismatch index is returned (or end1 in the
case of string= . These are the caseinsensitive variants.

stringhash s [bound start end]

Scheme Procedure 
stringhashci s [bound start end]

Scheme Procedure 
Return a hash value of the string s in the range 0 ...
bound  1. stringhashci is the caseinsensitive variant.
