0

I'm developing a program and one of its feature is a text file downloader. When the user presses the button "Download", the program downloads a text file on a Memo with a defined formatting.

Example 1

user_A:italy

user_B:usa

Each data is divided by ":" and I want add these datas into a StringGrid. So I thought to break the string each time that ":" char is found. The first line of the example on the memo becomes:

Example 2

user_A

italy

At this point the program adds the lines into a StringGrid, here you can see an image as example. I wrote this code:

for i:= 0 to 4096 do
 begin
   if (length(Memo1.Lines.Strings[i])>0) then
    begin
      StringGrid1.Cells[1,i+1]:=Memo1.Lines.Strings[i];
    end
   else
    begin
      break;
    end;
 end;

My problem is the following: when the text in the memo is user_A:italy for example, the result isn't a string with 2 lines [user_A(break line)italy], but it's still user_A:italy. I'm using this code:

s:=Memo1.Text;
s:=WrapText(s, #13#10,[':'],20);
Memo1.Lines.Add(s);

Do you have any suggestion?

Alberto Rossi
  • 1,800
  • 4
  • 36
  • 58

0 Answers0