std.conv.to!string(float) Is too heavy

Ogi ogion.art at gmail.com
Thu Oct 14 13:49:35 UTC 2021


On Tuesday, 12 October 2021 at 17:35:31 UTC, russhy wrote:
> i'd personally suggest using snprintf, but depending on your 
> usecase that might not be perfect
>
> ```d
> char[32] tmp = 0;
> snprintf(tmp.ptr, tmp.length, "Hello World %f", value);
> ```

Be aware of [the bug with 
`snprintf`](https://issues.dlang.org/show_bug.cgi?id=22266) when 
compiling for Windows.


More information about the Digitalmars-d mailing list