www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.stdio.writeln (without percent voodoo)

Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Just as I suspected, it was trivial to hack
another parameter onto std.format.doFormat,
to optionally make it ignore any percentages.

And then it's not that hard to implement
std.stdio.write and std.stdio.writeln,
which work the same - but without "format"!

 import std.stdio;
   
 void main()
 {
    writef("*** Hall\u00e5, ");
    writefln("V\u00e4rlden! ***");
    write("%%% Hall\u00e5, ");
    writeln("V\u00e4rlden! %%%");
    
    writefln("%d%%",100);
    writeln(100,"%");
 }

Full patch against DMD 0.112 is attached. Tested with GDC 0.10, without problems... (well, except the usual line-ending ones) --anders
Feb 03 2005