How to make a line with multiple lines in Delphi / Pascal

In C #, you can use multi-line literals to have a string that spans a physical line break in the source code, for example.

var someHtml = @"<table width="100%" border="0" cellspacing="0" cellpadding="5" align="center" class="txsbody"> <tbody> <tr> <td width="15%" class="ttxb">&nbsp;</td> <td width="85%" class="ttxb"><b>COMPANY NAME</b></td> </tr> </tbody> </table>"; 

but how to do it in delphi without using string concatenation, not for performance, but for visual viewing is just as good as in C # instead

 Result : = '<table width="100%" border="0" cellspacing="0" cellpadding="5" align="center" class="txsbody">'; Result : Result + '<tbody>'; 
+5
source share
1 answer

How to do this in delphi without using string concatenation?

You can not. There is no support for multiline literals. Concatenation is the only option.

However, your Delphi code does concatenation at runtime. This is much better done at compile time. Therefore, instead of:

 Result := 'foo'; Result := Result + 'bar'; 

records

 Result := 'foo' + 'bar'; 
+14
source

Source: https://habr.com/ru/post/1240363/


All Articles