HomeDelphiWhat is #13#10 in Delphi ?

What is #13#10 in Delphi ?

As a Delphi developer, you might notice the cryptic strings like 13#10. These strings serve some particular purpose for your applications.

What is #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:

program DeveloperPublish;
var
    testString    :    String;
begin
    testString    := 'Senthil' + #13#10 + 'Kumar';
    writeln(testString);
end.

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

The above example prints the testString in 2 lines .

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

    1 Comment

  1. Marsha Hatcher
    May 31, 2010
    Reply

    Really great post. Really.

Leave a Reply

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...