Node:String Comparison, Next:, Previous:String Modification, Up:Strings



21.4.7 String Comparison

The procedures in this section are similar to the character ordering predicates (see Characters), but are defined on character sequences. They all return #t on success and #f on failure. The predicates ending in -ci ignore the character case when comparing strings.

string=? s1 s2 Scheme Procedure
Lexicographic equality predicate; return #t if the two strings are the same length and contain the same characters in the same positions, otherwise return #f.

The procedure string-ci=? treats upper and lower case letters as though they were the same character, but string=? treats upper and lower case as distinct characters.

string<? s1 s2 Scheme Procedure
Lexicographic ordering predicate; return #t if s1 is lexicographically less than s2.

string<=? s1 s2 Scheme Procedure
Lexicographic ordering predicate; return #t if s1 is lexicographically less than or equal to s2.

string>? s1 s2 Scheme Procedure
Lexicographic ordering predicate; return #t if s1 is lexicographically greater than s2.

string>=? s1 s2 Scheme Procedure
Lexicographic ordering predicate; return #t if s1 is lexicographically greater than or equal to s2.

string-ci=? s1 s2 Scheme Procedure
Case-insensitive string equality predicate; return #t if the two strings are the same length and their component characters match (ignoring case) at each position; otherwise return #f.

string-ci<? s1 s2 Scheme Procedure
Case insensitive lexicographic ordering predicate; return #t if s1 is lexicographically less than s2 regardless of case.

string-ci<=? s1 s2 Scheme Procedure
Case insensitive lexicographic ordering predicate; return #t if s1 is lexicographically less than or equal to s2 regardless of case.

string-ci>? s1 s2 Scheme Procedure
Case insensitive lexicographic ordering predicate; return #t if s1 is lexicographically greater than s2 regardless of case.

string-ci>=? s1 s2 Scheme Procedure
Case insensitive lexicographic ordering predicate; return #t if s1 is lexicographically greater than or equal to s2 regardless of case.