Solved

End of Line Char...

Posted on 1998-03-31
7
983 Views
Last Modified: 2012-08-14
Hi,
    I would like to know the end line char in Delphi. I need to insert some lines of text into a memo, each on a seperate line.
Cheers.
0
Comment
Question by:PiersBull
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 4

Accepted Solution

by:
d003303 earned 10 total points
ID: 1361112
Yo,
here's a code snippet:

const NewLine = #10#13;
var AText : string;
begin
  AText := '1st Line';
  AText := AText + NewLine;
  AText := AText + '2nd Line';
end;

Slash/d003303
0
 

Author Comment

by:PiersBull
ID: 1361113
Hi ,
    Could you explain what this line is declaring :

Const
        NewLine = #10#13;
   
      Bear with me, I'm just a bit slow :`)
Cheers.

0
 
LVL 4

Expert Comment

by:d003303
ID: 1361114
Hi,
no prob. I declared an untyped constant, so you can concatinate it with a string, a PChar or an array of char. The NewLine constant is defining two characters, Carriage Return and Line Feed (i.E. Chr(10) and Chr(13)). These are the defined charcters to force a new line in DOS/Windows. On e.g. UNIX, it is only Carriage Return without Line Feed.
Clearer right now ?

Slash/d003303
0
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!

 

Author Comment

by:PiersBull
ID: 1361115
Hi again,
    When I try this, I get the 2 lines of text on the same line, separated by an end of line marker. It looks a bit like this :

Line1||Line2

whereas I want it to look like this :

Line1
Line2

Any ideas?
Cheers, Nik

0
 
LVL 4

Expert Comment

by:d003303
ID: 1361116
Sorry, my mistake. it should read

Const
  NewLine = #13#10;

Slash/d003303
0
 

Author Comment

by:PiersBull
ID: 1361117
Problem solved! Cheers!
0
 

Expert Comment

by:kentjohan
ID: 1361118
If you just want to insert lines to a memo you can use Lines.Append, like this:

mymemo.Lines.Append('Line1');
mymemo.Lines.Append('Line2');
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question