9

For example:

x := #123;

I tried to search around Google but I simply have no idea what this means.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Yana D. Nugraha
  • 5,069
  • 10
  • 45
  • 59

6 Answers6

13

IIRC it means a character value of the number (eg. #32 -> space).

jpalecek
  • 47,058
  • 7
  • 102
  • 144
  • 2
    #123 is the same thing as Chr(123), except it's a literal character constant instead of a builtin system function (Chr). – Warren P Jun 04 '10 at 15:27
  • FWIW, these days, Chr(32) does nothing. In reality it is not even a function, it is completely equivalent to #32 and Char(32). – Rudy Velthuis Apr 28 '16 at 23:04
7

#123 is a character (Char type) of the ordinal value 123.

Ondrej Kelle
  • 36,941
  • 2
  • 65
  • 128
4

It's character code. #97 is equivalent to 'a' etc etc

A chart can be see here.

CheesePls
  • 887
  • 1
  • 6
  • 17
2

It is an extention to standard Pascal, Borland Pascal accepts the pound sign ('#') followed immediately by a decimal number between 0 and 255 as a single character with that code.

SQLMenace
  • 132,095
  • 25
  • 206
  • 225
  • 3
    Well, in Delphi 2009+ all strings are Unicode, so you are not restricted to codes between 0 and 255 any more. For example, #$222b is the integral sign. (In Delphi, $ is the hexadecimal prefix.) – Andreas Rejbrand Jun 04 '10 at 14:48
  • You aren't restricted to that in prior versions, either, @Andreas. Delphi supported Unicode for more than a decade before Delphi 2009. – Rob Kennedy Jun 04 '10 at 15:01
  • Delphi supported WideChar literals for more than a decade? – Warren P Jun 04 '10 at 15:26
  • @Rob Kennedy: But you could not write Caption := #$222b and get an integral sign as the form's caption, right? – Andreas Rejbrand Jun 04 '10 at 15:51
  • Yes, @Warren. Delphi 4 supported them, and that was released in 1998. Andreas, you're right. – Rob Kennedy Jun 04 '10 at 17:52
0

As other have mentioned it's a character code, I most often see them used for line breaks in messages, or other control character such as Tab (#9)

ShowMessage('Error:'#13#10'Something terrible happened')

Strangely it's not necessary to concatinate a string involving these.

James
  • 9,774
  • 5
  • 34
  • 58
0

It's character code. #97 is equivalent to chr(97) etc etc

MajidTaheri
  • 3,813
  • 6
  • 28
  • 46