RosettaCodeData/Task/String-comparison/Picat/string-comparison.picat

14 lines
424 B
Plaintext

main =>
S1 = "abc",
S2 = "def",
S1 == S2, % -> false.
S1 != S2, % -> true.
S1 @< S2, % -> true. Is S1 lexicographically less than S1?
S1 @> S2, % -> false.
to_lowercase(S1) == to_lowercase(S2), % -> false.
"1234" @> "123", % -> true. lexical comparison
"1234" @< 12342222, % -> false. No coersion is done. Numbers are always ordered before strings
123 < 1234. % -> true '<' is used only for numbers