[fpc-pascal] Pascal equivalent to split/explode commands?

Lee Jenkins lee at datatrakpos.com
Mon Aug 11 22:34:17 CEST 2008


Francisco Reyes wrote:
> 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



More information about the fpc-pascal mailing list