chickadee » srfi-13 » string-prefix-length-ci

(string-prefix-length s1 s2 [start1 end1 start2 end2]) -> integerprocedure
(string-suffix-length s1 s2 [start1 end1 start2 end2]) -> integerprocedure
(string-prefix-length-ci s1 s2 [start1 end1 start2 end2]) -> integerprocedure
(string-suffix-length-ci s1 s2 [start1 end1 start2 end2]) -> integerprocedure

Return the length of the longest common prefix/suffix of the two strings. For prefixes, this is equivalent to the "mismatch index" for the strings (modulo the STARTi index offsets).

The optional start/end indices restrict the comparison to the indicated substrings of S1 and S2.

string-prefix-length-ci and string-suffix-length-ci are the case-insensitive variants. 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:

ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt

Comparison is simply done on individual code-points of the string.