actually i was opened question previously, but can't get answer what i exactly want, so i would like to ask again thanks All for example, i have some text file name is 'test.txt' , and inside text contents looks like
hello all good day happy is
and i want to modify following source to iterate from first index of 'hello all' i mean.. if i click showmessage(first) then i want get 'hello' inside test.txt file, and if click showmessage(second) then want to get 'all' and continuesly, if i click again showmessage(first) then want to get 'good' and click again showmessage(second) then want to get 'day' that what i want exactly. Thanks in advance! and thanks all who helped me already!
procedure TForm1.BitBtn1Click(Sender: TObject); var list : TStringList; first, second, third: string; begin list := TStringList.Create; try list.Delimiter := #32; list.LoadFromFile('test.txt'); first := list[0]; second := list[1]; ShowMessage(first); ShowMessage(second); finally list.Free; end; end;
Hello you can modify such like following ? i want to use showmessage(first) and showmessage(two) , if so much appreciate!
procedure TForm1.BitBtn1Click(Sender: TObject); var theFileStuff : tstringList; oneLine : tStringList; x,y : integer; begin theFileStuff := tStringList.Create; oneLine := tStringList.create; oneLine.Delimiter := #32; theFileStuff.LoadFromFile('test.txt'); for x := 0 to theFileStuff.count-1 do begin oneLine.DelimitedText := theFileStuff[x]; for y := 0 to oneLine.count-1 do //ShowMessage(oneLine[y]); ShowMessage(first); ShowMessage(second); end; oneLine.Free; theFileStuff.Free; end;