3.2.6 Constant strings

To specify a constant string, it must be enclosed in single-quotes, just as a Char type, only now more than one character is allowed. Given that S is of type String, the following are valid assignments:

S := ’This is a string.’;  
S := ’One’+’, Two’+’, Three’;  
S := ’This isn’’t difficult !’;  
S := ’This is a weird character : ’#145’ !’;

As can be seen, the single quote character is represented by 2 single-quote characters next to each other. Strange characters can be specified by their character value (usually an ASCII code). The example shows also that two strings can be added. The resulting string is just the concatenation of the first with the second string, without spaces in between them. Strings can not be subtracted, however.

Whether the constant string is stored as an ansistring or a short string depends on the settings of the {$H} switch.