把每一行都读出来并分别保存为 随机名.txt?可是执行后在D:/找不到这个文本文件.(30)

楚辞

Unregistered / Unconfirmed
GUEST, unregistred user!
把每一行都读出来并分别保存为 随机名.txt文本文件 中的列表如: Hello Hi How are you代码:(看看哪里还有改进的地方)procedure TForm1.btn1Click(Sender: TObject);var list:TStrings; lst:TStringList; i:Integer; ss,s:string;begin s:=''; ss:=''; lst:=TStringList.Create; // list:=TStrings.Create;mmo1.Lines.add('Hello Hi How are you'); list:=mmo1.Lines ; s:=list[0]; for i:=1 to Length(s) do begin if Copy(s,i,1)<>' ' then begin ss:= ss+Copy(s,i,1); end else begin lst.Add(ss); lst.SaveToFile('d:/'+ss+'.txt'); lst.Clear; ss:=''; end;end; lst.Free; end;
 

楚辞

Unregistered / Unconfirmed
GUEST, unregistred user!
ss:= ss+Copy(s,i,1); 这句有错吗?
 
F

fanronghua

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure SplitWithSpilterIntheHead(aValue: string; aDelimiter: TDelimiterSet; var Result: TStringList);var X: integer; s: string; cCurrentSplitter: string;begin if Result = nil then Result := TStringList.Create; Result.Clear; s := ''; cCurrentSplitter := ''; for X := 1 to Length(aValue) do begin if not (aValue[X] in aDelimiter) then begin s := s + aValue[X]; end else begin if cCurrentSplitter + s <> '' then Result.Add(cCurrentSplitter + s); cCurrentSplitter := aValue[X]; s := ''; end; end; if cCurrentSplitter + s <> '' then Result.Add(cCurrentSplitter + s);end;
 

楚辞

Unregistered / Unconfirmed
GUEST, unregistred user!
谢谢你的帮助.问题解决.
 
Top Bottom