J
javesun
Unregistered / Unconfirmed
GUEST, unregistred user!
在网上找东东,发现这样一个问题:
procedure SplitString(sSource, sSep: String
sl: TStrings);
var
sTemp: String;
i: Integer;
begin
sTemp:= sSource;
sl.Clear;
i:= Pos(sSep,sSource);
while i<> 0 do
begin
sl.Add(Copy(sTemp, 1, i-1));
Delete(sTemp, 1, i);
i:= Pos(sSep, sTemp);
end;
sl.Add(sTemp);
sSep:= '';
end;
procedure TForm1.Button1Click(Sender: TObject);
var
TmpStr1: TStringList;
s1, s2: String;
begin
TmpStr1:= TStringList.Create;
s1:= 'f@dsdf@sdf@sdfd@fff@fff@';
s2:= '@';
Memo1.Lines.Clear;
SplitString(s1, s2, TmpStr1);
TmpStr1.SaveToFile('c:/a.txt');
Memo1.Lines.LoadFromFile('c:/a.txt');
Memo1.Lines.Add(s2);
TmpStr1.Clear;
end;
为什么TmpStr里面会有值呢?没有定义返回值啊。。。。
procedure SplitString(sSource, sSep: String
sl: TStrings);
var
sTemp: String;
i: Integer;
begin
sTemp:= sSource;
sl.Clear;
i:= Pos(sSep,sSource);
while i<> 0 do
begin
sl.Add(Copy(sTemp, 1, i-1));
Delete(sTemp, 1, i);
i:= Pos(sSep, sTemp);
end;
sl.Add(sTemp);
sSep:= '';
end;
procedure TForm1.Button1Click(Sender: TObject);
var
TmpStr1: TStringList;
s1, s2: String;
begin
TmpStr1:= TStringList.Create;
s1:= 'f@dsdf@sdf@sdfd@fff@fff@';
s2:= '@';
Memo1.Lines.Clear;
SplitString(s1, s2, TmpStr1);
TmpStr1.SaveToFile('c:/a.txt');
Memo1.Lines.LoadFromFile('c:/a.txt');
Memo1.Lines.Add(s2);
TmpStr1.Clear;
end;
为什么TmpStr里面会有值呢?没有定义返回值啊。。。。