procedure TrimChar(s:string;var sRet : TArray);
function CountChar(s:string; c:char):integer;
var
i : integer;
begin
result := 0;
for i := 1 to Length(s) do
if s[i] = c then Inc(result);
end;
var
iPos : integer;
i : integer;
begin
SetLength(sRet, CountChar(s, ',') + 1);
iPos := Pos(',', s);
i := 0;
while iPos > 0 do
begin
sRet[i] := Copy(s, 1, iPos - 1);
Delete(s, 1, iPos);
iPos := Pos(',', s);
Inc(i);
end;
sRet[i] := s;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
sA : TArray;
s : string;
i : integer;
begin
s := 'abc,cd,mm,44';
sA := nil;
TrimChar(s, sA);
for i := Low(sA) to High(sA) do
Memo1.Lines.Add(sA[i]);
end;