String comparison: Difference between revisions

Content added Content deleted
(Add Avail entry)
Line 752: Line 752:
compare(5.0, 5)
compare(5.0, 5)
</lang>
</lang>

=={{header|Avail}}==
<lang Avail>Method "string comparisons_,_" is
[
a : string,
b : string
|
Print: "a & b are equal? " ++ “a = b”;
Print: "a & b are not equal? " ++ “a ≠ b”;
// Inequalities compare by code point
Print: "a is lexically before b? " ++ “a < b”;
Print: "a is lexically after b? " ++ “a > b”;
// Supports non-strict inequalities
Print: "a is not lexically before b? " ++ “a ≥ b”;
Print: "a is not lexically after b? " ++ “a ≤ b”;
// Case-insensitive comparison requires a manual case conversion
Print: "a & b are equal case-insensitively?" ++ “lowercase a = lowercase b”;
];</lang>
Avail is strongly-typed and the standard library's comparison functions do not admit mixed comparison between numerics and strings. Strings are immutable tuples of characters and are always compared by value -- few entities in Avail have identity so "object equality" is usually meaningless.


=={{header|AWK}}==
=={{header|AWK}}==