Is this bug ? format %(%)

Paul Backus snarwin at gmail.com
Wed Apr 7 13:43:18 UTC 2021


On Wednesday, 7 April 2021 at 13:31:59 UTC, novice3 wrote:
> there is extra quotes, wich not present in firmat specifier.
> is this bug, or i should change something in my code?

This is actually an intentional feature (albeit kind of a stupid 
one). From the documentation:

> Inside a compound format specifier, strings and characters are 
> escaped automatically. To avoid this behavior, add '-' flag to 
> "%(".

So, you should change your code to

     writefln("%-(%s, %)", s);


More information about the Digitalmars-d-learn mailing list