RosettaCodeData/Task/String-comparison/EMal/string-comparison.emal

16 lines
1.1 KiB
Plaintext

fun compare ← void by text a, text b
writeLine("Comparing `", a, "` and `", b, "`:")
text la ← a.lower()
text lb ← b.lower()
writeLine(" `", a, "` æ `", b, "` case sensitively: ", a æ b, ", case insensitively: ", la æ lb)
writeLine(" `", a, "` ≠ `", b, "` case sensitively: ", a ≠ b, ", case insensitively: ", la ≠ lb)
writeLine(" `", a, "` ◇ `", b, "` case sensitively: ", a ◇ b, ", case insensitively: ", la ◇ lb)
writeLine(" `", a, "` < `", b, "` case sensitively: ", a < b, ", case insensitively: ", la < lb)
writeLine(" `", a, "` > `", b, "` case sensitively: ", a > b, ", case insensitively: ", la > lb)
writeLine(" `", a, "` ≤ `", b, "` case sensitively: ", a ≤ b, ", case insensitively: ", la ≤ lb)
writeLine(" `", a, "` ≥ `", b, "` case sensitively: ", a ≥ b, ", case insensitively: ", la ≥ lb)
end
List samples ← Pair[text%text("Hello" ⇒ "Hello"), text%text("5" ⇒ "5.0"),
text%text("java" ⇒ "Java"), text%text("ĴÃVÁ" ⇒ "ĴÃVÁ"), text%text("ĴÃVÁ" ⇒ "ĵãvá")]
samples.list(<Pair pair|compare(pair.key, pair.value))