with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
procedure SS is
S : String := "This is this IS a TeSt String";
begin
Put_Line ("Search for ""this""");
Put_Line (Natural'Image (Index (S, "this")));
Put_Line ("Search for ""this"" but look at the Source string as if it " &
"was lower case");
Put_Line (Natural'Image (Index (Source => S,
Pattern => "this",
Mapping => Lower_Case_Map)));
Put_Line ("Search for ""this"" but look at the Source string as if it " &
"was lower case, but look for latest found in string of " &
"pattern");
Put_Line (Natural'Image (Index (Source => S,
Pattern => "this",
Going => Ada.Strings.Backward,
Mapping => Lower_Case_Map)));
Put_Line ("Search for ""this"" but look at the Source string as if it " &
"was upper case");
Put_Line (Natural'Image (Index (Source => S,
Pattern => "this",
Mapping => Upper_Case_Map)));
Put_Line ("Search for ""test"" but look at the Source string as if it " &
"was lower case, but look start after the 9th character");
Put_Line (Natural'Image (Index (Source => S (S'First + 9 .. S'Last),
Pattern => "test",
Mapping => Lower_Case_Map)));
end SS;
|