Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

All Memo Text in one Line

Hi.
I have a memo with some lines , like this :

Name : Richard Jakson
Age : 35
Adress : 5th Avenue

and i want like this

Name : Richard Jakson Age : 35 Adress : 5th Avenue

can someone help me ??? thnx a lot
0
fuscao_sp
Asked:
fuscao_sp
1 Solution
 
arjanhCommented:
var
  res : String;
  i : Integer;
begin
  res := '';
  for i := 0 to memo.lines.count - 1 do
    res := res + memo.lines[i];
end;
0
 
kretzschmarCommented:
or

procedure TForm1.Button1Click(Sender: TObject);
begin
  memo1.Text := stringReplace(memo1.text,#13#10,' ',[rfReplaceAll]);
end;

meikl ;-)
0
 
JackNaifCommented:
Both those solutions will most likely work.
Both will alter the contents of your memo to be in one line.

But if memo1.wordwrap is true, you will see it on screen as many lines unless your memo1.width is big enough to fit the whole lenght of the text. If you set it to false, then the text will go beyond the edge and you will have to scroll.

However if you want to process the text in your memo  as a single line while showing it on the screen as many lines, then you should make use of memo1.text. It has all the text in one single string. It's good for many applications such as storing it in a file where you already have other contents. (If you want to put only the contents of a single TMemo in a file, you use memo1.lines.SaveToFile, and then memo1.lines.LoadFromFile to get it back).

Hope it helps:

Jack
0
 
DeerBearCommented:
Hi,

Use Memo1.Lines.Text .

Cheers,

Andrew
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now