[Haskell-cafe] Best way to format a number

Maurí­cio briqueabraque at yahoo.com
Tue Nov 20 22:01:35 EST 2007


Hi,

I would like to get a string for a number
using always 2 digits (i.e., 75 would be
"75", 3 would became "03"). What is the
best way to do that? I tried

printf "%02d\n" 3

which gives me the correct string, but
ghci always ends that call with a

*** Exception: Prelude.undefined

message. What else should I try? Can
Text.PrettyPrint do that?

Thanks,
Maurício



More information about the Haskell-Cafe mailing list