[Webinar] Learn how to a build a cloud-first strategyRegister Now

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

End of Line Char...

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
PiersBull
Asked:
PiersBull
  • 3
  • 3
1 Solution
 
d003303Commented:
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
 
PiersBullAuthor Commented:
Hi ,
    Could you explain what this line is declaring :

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

0
 
d003303Commented:
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.

 
PiersBullAuthor Commented:
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
 
d003303Commented:
Sorry, my mistake. it should read

Const
  NewLine = #13#10;

Slash/d003303
0
 
PiersBullAuthor Commented:
Problem solved! Cheers!
0
 
kentjohanCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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