The OpenD Programming Language

sicmp

Does basic case-insensitive comparison of r1 and r2. This function uses simpler comparison rule thus achieving better performance than icmp. However keep in mind the warning below.

version(!std_uni_bootstrap)
int
sicmp
(
S1
S2
)
(
scope S1 r1
,
scope S2 r2
)

Parameters

r1 S1

an input range of characters

r2 S2

an input range of characters

Return Value

Type: int

An int that is 0 if the strings match, <0 if r1 is lexicographically "less" than r2, >0 if r1 is lexicographically "greater" than r2

Warning: This function only handles 1:1 $(CODEPOINT) mapping and thus is not sufficient for certain alphabets like German, Greek and few others.

Examples

assert(sicmp("Август", "авгусТ") == 0);
// Greek also works as long as there is no 1:M mapping in sight
assert(sicmp("ΌΎ", "όύ") == 0);
// things like the following won't get matched as equal
// Greek small letter iota with dialytika and tonos
assert(sicmp("ΐ", "\u03B9\u0308\u0301") != 0);

// while icmp has no problem with that
assert(icmp("ΐ", "\u03B9\u0308\u0301") == 0);
assert(icmp("ΌΎ", "όύ") == 0);

See Also

Meta