An int that is 0 if the strings match, <0 if str1 is lexicographically "less" than str2, >0 if str1 is lexicographically "greater" than str2
assert(icmp("Rußland", "Russland") == 0); assert(icmp("ᾩ -> \u1F70\u03B9", "\u1F61\u03B9 -> ᾲ") == 0);
By using std.utf.byUTF and its aliases, GC allocations via auto-decoding and thrown exceptions can be avoided, making icmp @safe @nogc nothrow pure.
import std.utf : byDchar; assert(icmp("Rußland".byDchar, "Russland".byDchar) == 0); assert(icmp("ᾩ -> \u1F70\u03B9".byDchar, "\u1F61\u03B9 -> ᾲ".byDchar) == 0);
Does case insensitive comparison of r1 and r2. Follows the rules of full case-folding mapping. This includes matching as equal german ß with "ss" and other 1:M $(CODEPOINT) mappings unlike sicmp. The cost of icmp being pedantically correct is slightly worse performance.