Multiline String Literals without linefeeds?

bearophile bearophileHUGS at lycos.com
Mon Sep 23 02:42:57 PDT 2013


John Carter:

> is there a similar mechanism in D? Or should I do...
>
> string foo =
> "long"
> "string"
> "without"
> "linefeeds"
> ;

Genrally you should do:


string foo = "long" ~
              "string" ~
              "without" ~
              "linefeeds";

See also:
http://d.puremagic.com/issues/show_bug.cgi?id=3827

You could also write a string with newlines and then remove them 
at compile-time with string functions.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list