www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.format.doFormat help

reply "Asaf Karagila" <kas1 netvision.net.il> writes:
the documentation of the module is ambiguous,
can anyone please explain a bit about the doFormat usage ?

Cheer,
Asaf
Oct 10 2004
parent reply Sean Kelly <sean f4.ca> writes:
Asaf Karagila wrote:
 the documentation of the module is ambiguous,
 can anyone please explain a bit about the doFormat usage ?

Basically, usage is liek a more flexible version of printf. You can supply optional format strings plus the stuff you want to print. It's really meant to be used via writef of string.format though. Do you have any specific questions? Sean
Oct 10 2004
parent reply "Asaf Karagila" <kas1 netvision.net.il> writes:
"Sean Kelly" <sean f4.ca> wrote in message 
news:ckc12p$2run$1 digitaldaemon.com...
 Asaf Karagila wrote:
 the documentation of the module is ambiguous,
 can anyone please explain a bit about the doFormat usage ?

Basically, usage is liek a more flexible version of printf. You can supply optional format strings plus the stuff you want to print. It's really meant to be used via writef of string.format though. Do you have any specific questions? Sean

well, Murphy's Law hit me again on this subject.. i was looking for a way to convert my md5 digest into a hexdecimal string, and only after i posted the question i saw std.string.format.. but still, my main question is what exactly is the parameter list for doFormat ? how does it look like ? Cheers, Asaf
Oct 10 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Asaf Karagila" <kas1 netvision.net.il> wrote in message
news:ckd568$kmo$1 digitaldaemon.com...
 i was looking for a way to convert my md5 digest into a hexdecimal string,
 and only after i posted the question
 i saw std.string.format..
 but still, my main question is what exactly is the parameter list for
 doFormat ?
 how does it look like ?

This is what std.md5.printDigest() looks like: /* Prints a message digest in hexadecimal. */ void printDigest(ubyte digest[16]) { foreach (ubyte u; digest) printf("%02x", u); } I think what you're looking for is std.string.format(), not std.format.doFormat().
Oct 11 2004
parent "Asaf Karagila" <kas1 netvision.net.il> writes:
"Walter" <newshound digitalmars.com> wrote in message 
news:ckfmut$2qum$2 digitaldaemon.com...
 "Asaf Karagila" <kas1 netvision.net.il> wrote in message
 news:ckd568$kmo$1 digitaldaemon.com...
 i was looking for a way to convert my md5 digest into a hexdecimal 
 string,
 and only after i posted the question
 i saw std.string.format..
 but still, my main question is what exactly is the parameter list for
 doFormat ?
 how does it look like ?

This is what std.md5.printDigest() looks like: /* Prints a message digest in hexadecimal. */ void printDigest(ubyte digest[16]) { foreach (ubyte u; digest) printf("%02x", u); } I think what you're looking for is std.string.format(), not std.format.doFormat().

yes, i know.. but i didn't know of that when i posted the original message.. anyway, i solved my problem so everything is ok now.. Cheers, Asaf
Oct 12 2004