Tokenize a string: Difference between revisions

Content added Content deleted
(→‎{{header|Ada}}: More proper use of 'Range and 'First)
Line 51: Line 51:
procedure Parse_Commas is
procedure Parse_Commas is
Source_String : String := "Hello,How,Are,You,Today";
Source_String : String := "Hello,How,Are,You,Today";
Index_List : array(1..256) of Natural;
Index_List : array(Source_String'Range) of Natural;
Next_Index : Natural := 1;
Next_Index : Natural := Index_List'First;
begin
begin
Index_List(Next_Index) := 1;
Index_List(Next_Index) := Source_String'First;
while Index_List(Next_Index) < Source_String'Last loop
while Index_List(Next_Index) < Source_String'Last loop
Next_Index := Next_Index + 1;
Next_Index := Next_Index + 1;