GNAT.Spitbol Example
-- 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;
Contributed by: David Botton
Contributed on: May 19, 1999
License: Public Domain
Back