write multiple lines without "\n" with writeln

uri via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 20 02:38:06 PST 2014


On Thursday, 20 November 2014 at 08:28:11 UTC, Suliman wrote:
> In dco source code I have found:
>
> void ShowUsage()
> {
> writeln("
> dco build tool " ~ strVersion ~ "
> written by FrankLIKE.
> Usage:
> dco [<switches...>] <files...>
> for example: dco
> or: dco app.d
> build for dfl2: dco
> ....
> }
>
> I do not see here any "\n". Why this code is output all one by 
> line, and not in single line?
>
> Why my code:
> writeln("App name:" ~ appName ~
> "App version:" ~ appVersion ~
> "To see help please use -h\\-help option");
> writeln(args);
>
> output:
> App name:CoolAppApp version:0.0.1To see help please use 
> -h\-help option[".\\app1
> .exe"]

"In all string literal forms, an EndOfLine is regarded as a 
single \n character."

http://dlang.org/lex.html



It's by design but is *really* annoying and should be limited to 
WysiwygString literals IMO.

Auto-formatting with clang-format or astyle can mess up writeln 
formatting completely.

Cheers,
uri


More information about the Digitalmars-d-learn mailing list