I need to compare two string
s (and not ASCII-only) in D ignoring case. The obviously solution is:
s1.toUpper() == s2.toUpper()
But I want to avoid strings duplications or write one myself in favor of a possibily fastest native onde (if any).
From exactly 30 seconds looking up the online D reference at:
http://dlang.org/phobos/std_string.html
I found String.icmp
:
alias icmp = std.uni.icmp(S1, S2)(S1 str1, S2 str2) if (isForwardRange!S1 && is(Unqual!(ElementType!S1) == dchar) && isForwardRange!S2 && is(Unqual!(ElementType!S2) == dchar));
Compares two ranges of characters lexicographically. The comparison is case insensitive. Use std.algorithm.cmp for a case sensitive comparison. For details see std.uni.icmp.
< 0 s1 < s2
= 0 s1 == s2
> 0 s1 > s2