Text String Split

Hello friends, I have a text that I separate with this command

var
len :integer;
s  :string;
begin
s:= 'Have a nice day';
while s<>'' do
begin
len := pos(' ', s);
if len=0 then len := Length(s);
Memo1.Text:=h;(copy(s, 0, len));
s := copy(s, len+1, Length(s)-len);    
end;  
end;

The output is displayed in Memo1 = "day"

The problem is that only the last letter is displayed. I want to output all letters separately

How to get each sentence in Memo separately from the output?

like this :

Memo1.Text:='Have'
Memo2.Text:='a'
Memo3.Text:='nice'
Memo4.Text:='day'


Leave a Comment