Format Hex values?
BlitzMax Forums/Brucey's Modules/Format Hex values?
| ||
Hi Brucey, thanks for your very useful modules. I'm trying out Format, which is alot like the format function in C. However, it seems like hexadecimal/binary are not supported, could this perhaps be added? Format ("%2x", 10) ' " a" Format ("%02X", 10) ' "0A" Format ("%08b", 10) ' "00001010" I think the C version also had %o for octal, but I don't think anyone uses that anymore. |
| ||
Hi :-) I've just updated the Format module to give Native printf support, rather than my hacky BlitzMax-only attempt. You can find out more about it (and download) at the maxmods site here : http://code.google.com/p/maxmods/wiki/FormatModule Since it's using snfprintf internally now you get automatic support for hex output. Unfortunately the printf family do not support binary output as default (I see that it does for php though). :o) Enjoy! |
| ||
Thanks! I just tried it, there still seems to be a DebugLog somewhere, that prints the format string (for LongArg). For decimal printing I did like your extra "," option that printed thousands, but I can easily add those to the result myself. |