?
Solved

End of Line Char...

Posted on 1998-03-31
7
Medium Priority
?
985 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 40 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 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