做了一个过程,用于分离数字
procedure getnum(str:string);
var
i,start,len:integer;
s:string;
begin
s:=str;
len:=length(s);
if len>0 then
begin
start:=1;
for i:=1 to len do
if ord(s[i])=32 then
begin
form1.memo1.Lines.Add(copy(s,start,i-start));
start:=i+1;
end;
if start<len then
form1.memo1.Lines.Add(copy(s,start,len-start+1));
end;
end;
////然后在下面的语句调用该过程即可
var
F: TextFile;
s:string;
ms:TStringList;
begin
AssignFile(F, '文件路径 ');
ms:=TStringList.Create;
Reset(F);
while not Eof(F) do
begin
Readln(F,S);
getnum(s);
end;
CloseFile(F);
end;
var
F: TextFile;
s:string;
ms:TStringList;
begin
AssignFile(F,'文件路径');
ms:=TStringList.Create;
Reset(F);
while not Eof(F) do
begin
Readln(F,S);
ms.Add(S);
end;
CloseFile(F);
end;