Table of contents
1. The length of the string is allowed to exceed 255
1. The length of the string is allowed to exceed 255
String literals can now be longer than 255 characters; in other words, string literals are no longer restricted to the classic Pascal ShortString type. Note that the length of literal strings may still be limited by the editor (4K characters per line).
4K characters per line). There is no change in syntax; you just use literal strings longer than 255 characters.
Literal strings up to 600+ characters long in the editor above.
2. New multi-string function
The language has added support for multi-line strings. Multiline strings are introduced by triple quotes (''') and newlines, resulting in multiline source code, and terminated by triple quotes (''') on a line without any text. Note that adding text outside the triple quotes on the first line has no effect. Importantly, there is no need to concatenate lines into single-line strings with + signs.
Multi-line literal strings in the editor above
Another example:
const
str1 = 'ABC'; // single line string
str2 = ''; // empty string
str3 = ''''
; // not a multiline string. It contains #$22
strML1 = '''
The quick brown fox jumps
over the lazy dog.
'''; // multiline string
strHTML = '''
<UL>
<LI>Item 1</LI>
Copyright © 2023 Embarcadero Technologies, Inc. | Embarcadero Confidential/NDA
<LI>Item 2</LI>
<LI>Item 3</LI>
<LI>Item 4</LI>
</UL>
''';
strJSON = '''
[
{"id" : "1", "name" : "Large"},
{"id" : "2", "name" : "Medium"},
{"id" : "2", "name" : "Small"}
]
''';
strSQL= '''
SELECT *
FROM Customers
WHERE Department = 'R&D'
ORDER BY Name;
''';
// The string below is invalid: there is text before the new line
strInvalidString= '''SELECT *
FROM Customers
WHERE Department = 'R&D'
ORDER BY Name;
''';
When pasting multiline text from an external application into the RAD Studio editor, keep in mind that there may be some special invisible characters, control characters, specific line break combinations or unusual Unicode characters when pasting multiline text in the editor Paste is required. These characters can confuse editors.