Technology Programming

How to split a string into an array

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

Related posts "Technology : Programming"

The Importance Of Having a WordPress Business Theme

Programming

Website Design Is Necessary For Your Website

Programming

The Most effective On line Paid Survey Evaluation

Programming

Adelaide SEO - Links And Keywords, How Should They Be Used

Programming

C Programming Compilers for Microcontrollers

Programming

How Should A DJ Make Music Logo That Is Distinct And Cool?

Programming

Call to Action Concepts for Small Businesses

Programming

Microsoft Access Databases in Office 365

Programming

Why web design is crucial for producing world class websites

Programming

Leave a Comment