unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type userarray=array of string;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
function split(s: string; dot: char): userarray;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses StrUtils;
{$R *.dfm}
function TForm1.split(s:string;dot:char):userarray;
var
str:userarray;
i,j:integer;
begin
i:=1;
j:=0;
SetLength(str, 255);
while Pos(dot, s) > 0 do
begin
str[j]:=copy(s,i,pos(dot,s)-i);
i:=pos(dot,s)+1;
s[i-1] := chr(ord(dot)+1);
j:=j+1;
end;
str[j]:=copy(s,i,strlen(pchar(s))-i+1);
result:=str;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ur:userarray;
i:Integer;
begin
ur:=split(Edit1.Text,';');
for i :=0 to 255 do
begin
if length(ur[i])=0 then Exit;
ShowMessage(ur[i]);
end;
end;
end.