Solved

End of Line Char...

Posted on 1998-03-31
7
978 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now