Previous topic | Ada Home Page | Index

Concatenation example

Program


-------------------------------------------------
-- Skansholm page 84
-- Convert date formats
-- Demonstrate slices and concatenation
-------------------------------------------------

with TEXT_IO; use  TEXT_IO;

procedure translate_date is
 
    date : STRING (1..8);
 
begin
    PUT_LINE ("Enter date as mm/dd/yy");
    GET (date);

    PUT_LINE ("The british form of the date is: ");
    PUT_LINE (date(4..5) & 
              "/" &
              date(1..2) & 
              "/" &
              date(7..8));

    PUT_LINE ("The ISO form of the date is: ");
    PUT_LINE ("19" & 
              date(7..8) & 
              "-" & 
              date(1..2) & 
              "-" & 
              date(4..5));

end translate_date;


Program Execution

Enter date as mm/dd/yy
05/02/95
The british form of the date is:
02/05/95
The ISO form of the date is:
1995-05-02


Previous topic | Ada Home Page | Index
c-lokan@adfa.oz.au / 12 Feb 96