Multiline string literal improvements

sarn sarn at theartofmachinery.com
Tue Oct 10 22:16:00 UTC 2017


On Tuesday, 10 October 2017 at 21:38:41 UTC, captaindet wrote:
>> string a = |q{
>>                   firstLine();
>>                   if (cond) {
>>                       secondLine()
>>                   }
>>                };
>
> you could write your own string processing function according 
> to your needs

FWIW, that's the solution in Python:
https://docs.python.org/release/3.6.3/library/textwrap.html#textwrap.dedent

Works even better in D because it can run at compile time.


More information about the Digitalmars-d mailing list