Easy way to format int in pragma msg ?

WebFreak001 d.forum at webfreak.org
Thu May 14 10:58:34 UTC 2020


On Thursday, 14 May 2020 at 09:49:15 UTC, wjoe wrote:
> Is there an easy way to print an int in hexadecimal, octal or 
> binary representation ?
>
> The documentation on pragma(msg, ...) and a quick web search 
> didn't provide an answer.

for simple hex/binary/etc printing use

   import std.conv;
   pragma(msg, i.to!string(16));

where you can replace 16 with your target base.

You can also use format as in the previous reply if you want more 
formatting control


More information about the Digitalmars-d-learn mailing list