http://d.puremagic.com/issues/show_bug.cgi?id=7282
Summary: std.string.format throws at runtime where writef works
fine
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 2012-01-12
12:11:01 PST ---
module test;
import std.array;
import std.conv;
import std.range;
import std.string;
import std.stdio;
auto pretty(string src)
{
Appender!(dchar[]) res;
size_t i;
foreach (dchar ch; retro(src))
{
if (++i % 3 == 0)
res.put("_");
res.put(ch);
}
return retro(res.data);
}
void main()
{
// ok, "123_456"
writefln("%s", pretty("123456"));
// FormatException
// std.format.FormatException@std\format.d(3956):
// Can't convert std.range.retro!(dchar[]).retro.Result to string:
// "string toString()" not defined
auto str1 = format("%s", pretty("123456"));
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------