Browse thread
sprintf-Bug?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jonathan Roewen <jonathan.roewen@g...> |
| Subject: | Re: [Caml-list] sprintf-Bug? |
Don't think so. I'm pretty sure padding of strings is only with spaces. Padding of numbers has to be specified for a number format. let hex_of_byte b = Printf.sprintf "%02X" b;; Why you'd use two sprintfs is the real oddity =P Jonathan On 2/4/07, Oliver Bandel <oliver@first.in-berlin.de> wrote: > Hello, > > this I explored: > > # let hex_of_byte b = Printf.sprintf "%02s" (Printf.sprintf "%0X" b);; > val hex_of_byte : int -> string = <fun> > # hex_of_byte 12;; > - : string = " C" > > Shouldn't the result be "0C" ?! > (I'm using OCaml 3.09.3.) > > > Ciao, > Oliver > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >