Thread overview
std.format.doFormat help
Oct 10, 2004
Asaf Karagila
Oct 10, 2004
Sean Kelly
Oct 11, 2004
Asaf Karagila
Oct 12, 2004
Walter
Oct 12, 2004
Asaf Karagila
October 10, 2004
the documentation of the module is ambiguous,
can anyone please explain a bit about the doFormat usage ?

Cheer,
Asaf


October 10, 2004
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
October 11, 2004
"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


October 12, 2004
"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().


October 12, 2004
"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