On Saturday, 17 October 2015 at 10:54:19 UTC, Dmitry Olshansky wrote:
On 17-Oct-2015 13:06, Shriramana Sharma wrote:
Dmitry Olshansky wrote:

Feel free to improve on the examples, I'd gladly pull such patches.

How about this, using the "comifying" regex from the replaceAll example:

     auto re = ctRegex!(`(?<=\d)(?=(\d\d\d)+\b)`, "g");
     auto sink = appender!(char [])();
     foreach (line; stdin.byLine())
     {
         sink.clear();
         replaceAllInto(sink, line, re, ",");
         writeln(sink.data());
     }


My problem with it is writeln/byLine b/c it can't be unittested. Documented unit-tests as examples are gold.


You can prefix it with `version(StdDdoc)`, then it will only appear in the documentation. It won't be really tested of course, but the compiler will at least do syntax checking on it, I guess.

Reply via email to