#13#10 in Delphi

These are the control characters in delphi that are used to format strings.

If a string value has to be entered in a multiline , we can use this .

Eg:

var
testString    :    String;

testString    := 'Senthil' + #13#10 + 'Kumar';
MessageDlg(testString,mtConfirmation,,0);

#13 represents a carriage-return and #10 represents a line-feed combination.

The above example prints the testString in 2 lines .

If you want to know about the difference between carriage-return and Line-feed Click here .

In delphi , the constant sLineBreak can be used instead of the the above which is already defined in the System Unit file.

Also note that sLineBreak value is different in Windows and Linux .

#10 in Linux and #13#10 in windows .

So that above example can be written as.

testString    := 'Senthil' + sLineBreak + 'kumar';

Alternatively , we can also use

testString    := 'Senthil' +  ^M + ^J + 'Kumar';

Some examples of the control characters are :

Char. Dec. hex Comments
NUL 00 00
BEL 07 07 ^G Bell or tone
BS 08 08 ^H Backspace
HT 09 09 ^I Horizontal Tab
LF 10 0A ^J Line Feed
VT 11 0B ^K Vertical Tab
FF 12 0C ^L Form Feed
CR 13 0D ^M Carriage Return

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

One Response

  1. Marsha Hatcher May 31, 2010 Reply

Leave a Reply


x

Interesting BlogPosts to read

Delphi 1 to XE7: 20 Years of Continuous Innovation by David I
Here's a video on Delphi 1 to XE7: 20 Years of Continuous Innovation by David I which talks about th...
Var keyword in Delphi/Oxygene and C#
I had the privilege of working on some of the interesting languages like Delphi, Oxygene, C# etc. ...
CodeRage Mobile Session Replays Download now available
CodeRage Mobile is an online developer Mobile conference that organised by Embarcadero on June 18 an...