I have some VB source code and want to convert it to Delphi:
Do While Not EOF(textfile)
Line Input #textfile, Line
Dim retstring() As String
retstring = Split(Line, Chr(32))
first = retstring(0)
second = retstring(1)
I have some text file with lines similar to these:
hello all nice to good day
I tried some of the source code in the answers, but am still having problems. I see the messages 'hello all' and 'nice to', but actually I want to see 'hello' and 'all' instead.
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;