RosettaCodeData/Task/String-comparison/Ada/string-comparison.ada

29 lines
1 KiB
Ada
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
with Ada.Text_IO, Ada.Strings.Equal_Case_Insensitive;
2013-06-05 21:47:54 +00:00
procedure String_Compare is
2016-12-05 22:15:40 +01:00
procedure Print_Comparison (A, B : String) is
2013-06-05 21:47:54 +00:00
begin
2016-12-05 22:15:40 +01:00
Ada.Text_IO.Put_Line
("""" & A & """ and """ & B & """: " &
(if A = B then
"equal, "
elsif Ada.Strings.Equal_Case_Insensitive (A, B) then
"case-insensitive-equal, "
else "not equal at all, ") &
(if A /= B then "/=, " else "") &
(if A < B then "before, " else "") &
(if A > B then "after, " else "") &
(if A <= B then "<=, " else "(not <=), ") &
(if A >= B then ">=. " else "(not >=)."));
2013-06-05 21:47:54 +00:00
end Print_Comparison;
begin
2016-12-05 22:15:40 +01:00
Print_Comparison ("this", "that");
Print_Comparison ("that", "this");
Print_Comparison ("THAT", "That");
Print_Comparison ("this", "This");
Print_Comparison ("this", "this");
Print_Comparison ("the", "there");
Print_Comparison ("there", "the");
2013-06-05 21:47:54 +00:00
end String_Compare;