AdaPower Logged in as Guest
Ada Tools and Resources

Ada 95 Reference Manual
Ada Source Code Treasury
Bindings and Packages
Ada FAQ


Join >
Articles >
Ada FAQ >
Getting Started >
Home >
Books & Tutorials >
Source Treasury >
Packages for Reuse >
Latest Additions >
Ada Projects >
Press Releases >
Ada Audio / Video >
Home Pages >
Links >
Contact >
About >
Login >
Back
GNAT.Spitbol Example (David Botton)

-- GNAT.Spitbol Example
--
-- Spitbol style string functions

with GNAT.Spitbol; use GNAT.Spitbol;
with GNAT.IO; use GNAT.IO;

procedure Spit is
   Test_String : VString;
begin
   Test_String := V("Hello World!");
   Put_Line(S(Test_STring));

   Put_Line("The ascii value 68 = " & Char(68));

   declare
      New_String : VString := Lpad(Str => V(""),
                                   Len => 40,
                                   Pad => '*');
   begin
      Put_Line("|" & S(New_String) & "|");

      New_String := Lpad(Str => Test_String,
                         Len => 40,
                         Pad => '-');

      Put_Line("|" & S(New_String) & "|");

      New_String := Rpad(Str => Test_String,
                                  Len => 40,
                                  Pad => ' ');

      Put_Line("|" & S(New_String) & "|");

      Trim(New_String);
      Put_Line("|" & S(New_String) & "|");
   end;

   Put_Line(S(Reverse_String(Test_String)));

   Put_Line(S(Substr(Str   => Test_String,
                     Start => 7,
                     Len   => 5)));

   for N in Integer range 1 .. 10 loop
      declare
         VCount : VString := V("Count") & N;
         SCount : String  := "Count" & N;
      begin
         Put_Line(S(VCount));
         Put_Line(SCount);
         Put_Line(S(N));
      end;
   end loop;

end Spit;


(c) 1998-2004 All Rights Reserved David Botton