Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-08

Pascal equivalent to split/explode commands?

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Francisco Reyes

Is there anything simmilar to the functions other languages have split/explode?

I will be reading a delimited file, usually tabs, and want to parse it into variables or some form of array.

Lee Jenkins
to Francisco Reyes: Is there anything simmilar to the functions other languages have split/explode? I will be…
Francisco Reyes wrote 5 lines
Is there anything simmilar to the functions other languages have split/explode? I will be reading a delimited file, usually tabs, and want to parse it into variables or some form of array.
var
   SL: TStringList;
begin
   SL := TStringList.Create;
   try
     SL.Delimiter := ',';
     SL.DelimitedText := 'This,Is,Some,Delimited,Text';
     ShowMessage(SL[0] + ' ' + SL[2]);
   finally
     SL.free;
   end;
end;

The above will display "This Some" in the message box.

Warm Regards, Lee