When you create a string type in your delphi program with more than 255 elements, assign a string literal with more than 255 characters to a variable of type ShortString, or have more than 255 characters in a single character string, you’ll see this error notice.
You can create large string literals that span multiple lines by concatenating several string literals using the ‘+’ operator.
program Produce; var LongString : string[256]; (*<-- Error message here*) begin end. In the example above, the length of the string is just one beyond the limit. program Solve; var LongString : AnsiString; begin end.
The most convenient way is to use the new long strings; this eliminates the need to consider what a suitable maximum length might be.
Leave a Reply