A simple function that accepts a string and a delimiter char, splits a string into tokens (TStringList items) delimited with a char value.
~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.Button1Click(Sender: TObject) ;
var
A: TStringList;
begin
A := TStringList.Create;
try
Split(' ', 'your delphi guide', A) ;
ShowMessage(a[0]) ; //your
ShowMessage(a[1]) ; //delphi
ShowMessage(a[2]) ; //guide
finally
A.Free;
end;
end;
}
procedure Split
(const Delimiter: Char;
Input: string;
const Strings: TStrings) ;
begin
Assert(Assigned(Strings)) ;
Strings.Clear;
Strings.Delimiter := Delimiter;
Strings.DelimitedText := Input;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» How to get DBGrid Cell coordinates
« Adding QuickReports to the Delphi 7 Component Palette