[phobos] Example from std.format throws exception
ikornilov via phobos
phobos at puremagic.com
Thu Jul 20 03:11:01 PDT 2017
Example
https://run.dlang.io/?compiler=dmd&source=void%20main()%0A%7B%0A%20import%20std.format;%0A%20import%20std.stdio:%20write,%20writeln,%20writef,%20writefln;%0A%20writeln(format(%22%25,d%22,%201000));%20%2F%2F%20%221,000%22%0A%20writeln(format(%22%25,f%22,%201234567.891011));%20%2F%2F%20%221,234,567.891,011%22%0A%20writeln(format(%22%25,%3Fd%22,%20%27%3F%27,%201000));%20%2F%2F%20%221%3F000%22%0A%20writeln(format(%22%25,1d%22,%201000));%20%2F%2F%20%221,0,0,0%22%0A%20writeln(format(%22%25,*d%22,%204,%20-12345));%20%2F%2F%20%22-1,2345%22%0A%20writeln(format(%22%25,*%3Fd%22,%204,%20%27_%27,%20-12345));%20%2F%2F%20%22-1_2345%22%0A%20writeln(format(%22%25,6%3Fd%22,%20%27_%27,%20-12345678));%20%2F%2F%20%22-12_345678%22%0A%20assert(format(%22%2512,3.3f%22,%201234.5678)%20%3D%3D%20%22%201,234.568%22,%20%22%27%22%20~%0A%20format(%22%2512,3.3f%22,%201234.5678)%20~%20%22%27%22);%0A%7D from page https://dlang.org/phobos/std_format.html throws exception:
std.format.FormatException at C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(1744): integral
More information about the phobos
mailing list