Quick start manual
13-10
Delphi Language Guide
Expressions
String constants
String constants must be enclosed in single or double quotation marks. Two
consecutive quotation marks of the same type as the enclosing quotation marks count
as only one character. Here are some examples of string constants:
'Z'
'Delphi'
‘Linux’
"That's all folks"
'"That''s all folks," he said.'
'100'
'"'
"'"
String constants of any length are allowed in DB directives, and cause allocation of a
sequence of bytes containing the ASCII values of the characters in the string. In all
other cases, a string constant can be no longer than four characters and denotes a
numeric value which can participate in an expression. The numeric value of a string
constant is calculated as
Ord(Ch1) + Ord(Ch2) shl 8 + Ord(Ch3) shl 16 + Ord(Ch4) shl 24
where Ch1 is the rightmost (last) character and Ch4 is the leftmost (first) character. If
the string is shorter than four characters, the leftmost characters are assumed to be
zero. The following table shows string constants and their numeric values.
Table 13.2 String examples and their values
String Value
'a' 00000061H
'ba' 00006261H
'cba' 00636261H
'dcba' 64636261H
'a ' 00006120H
'a' 20202061H
'a' * 2 000000E2H
'a'-'A' 00000020H
not 'a' FFFFFF9EH