1. Technology

What does #13#10 stand for, in Delphi code?


You've certainly seen "#13#10" many times in Delphi source code. If you are wondering what those characters stand for, here's the answer:

A control string is a sequence of one or more control characters, each of which consists of the # symbol followed by an unsigned integer constant from 0 to 255 (decimal or hexadecimal) and denotes the corresponding ASCII character.

When you want to, for example, assign a two-line string to a Caption property (of a TLabel control), you can use the following "code:"

Label1.Caption := 'First line' + #13#10 + 'Second line';

The "#13#10" part represents a carriage-return + line-feed combination. The "#13" is the ASCII equivalent to the CR (carriage return) value; #10 represents LF (line feed).

Two more interesting control characters are:
#0 - NULL character and
#9 - (horizontal) TAB

Note: here's how to translate a virtual-key to ASCII code.

Delphi tips navigator:
» How to exchange Bitmap images between two TImageList components
« How to set the DataSource property to several db-aware controls in one call

©2014 About.com. All rights reserved.