下面的代码是把字符串拆开:
procedure TForm1.Button1Click(Sender: TObject);
var S,tempstr :String;
a:array[1..4] of string;
i,j:integer;
begin
tempstr:='';
j:=1;
s:='aaaaa,aaaaa,ddddd,ssss';
for i:=1 to length(s) do
if s[i]=',' then
begin
a[j]:=tempstr;
j:=j+1;
tempstr:='';
end
else
tempstr:=tempStr+s[i]; if tempstr<>'' then
a[High(a)]:=tempstr;
for i:=low(a) to High(a) do
ShowMessage(a[i]);
end;
procedure TForm1.Button1Click(Sender: TObject);
var S,tempstr :String;
a:array[1..4] of string;
i,j:integer;
begin
tempstr:='';
j:=1;
s:='aaaaa,aaaaa,ddddd,ssss';
for i:=1 to length(s) do
if s[i]=',' then
begin
a[j]:=tempstr;
j:=j+1;
tempstr:='';
end
else
tempstr:=tempStr+s[i]; if tempstr<>'' then
a[High(a)]:=tempstr;
for i:=low(a) to High(a) do
ShowMessage(a[i]);
end;
其实我是在做一个存放如下格式的文件,
金山快译 2000=D:\Program Files\KINGSOFT\FastAIT\FastAIT.exe,
读取其中的内容到相应的变量中
再辨别其路径是否正确刚刚我又发了一个“如何辨别正确的文件路径??”
问题解决后,稍后给分!!!!