Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.04 KB | None | 0 0
  1. with Ada.Text_IO, Ada.Strings.Equal_Case_Insensitive;
  2.  
  3. procedure String_Compare is
  4.  
  5.    procedure Print_Comparison (A, B : String) is
  6.    begin
  7.       Ada.Text_IO.Put_Line
  8.          ("""" & A & """ and """ & B & """: " &
  9.           (if A = B then
  10.               "equal, "
  11.            elsif Ada.Strings.Equal_Case_Insensitive (A, B) then
  12.               "case-insensitive-equal, "
  13.            else "not equal at all, ")                   &
  14.           (if A /= B then "/=, "     else "")           &
  15.           (if A <  B then "before, " else "")           &
  16.           (if A >  B then "after, "  else "")           &
  17.           (if A <= B then "<=, "     else "(not <=), ") &
  18.           (if A >= B then ">=. "     else "(not >=)."));
  19.    end Print_Comparison;
  20. begin
  21.    Print_Comparison ("this", "that");
  22.    Print_Comparison ("that", "this");
  23.    Print_Comparison ("THAT", "That");
  24.    Print_Comparison ("this", "This");
  25.    Print_Comparison ("this", "this");
  26.    Print_Comparison ("the", "there");
  27.    Print_Comparison ("there", "the");
  28. end String_Compare;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement