caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe TROESTLER <Christophe.Troestler+ocaml@umh.ac.be>
To: caml-list@inria.fr
Subject: Re: [Caml-list] sprintf-Bug?
Date: Sun, 04 Feb 2007 11:41:45 +0100 (CET)	[thread overview]
Message-ID: <20070204.114145.182918936.Christophe.Troestler+ocaml@umh.ac.be> (raw)
In-Reply-To: <20070204015122.GA3882@first.in-berlin.de>

On Sun, 4 Feb 2007, Oliver Bandel <oliver@first.in-berlin.de> wrote:
> 
> And "%0s" should make it with a filling-char '0'
> instead of filling-chars ' '.

No, reread the documentation:

   - [0]: for numerical conversions, pad with zeroes instead of spaces.
          ^^^^^^^^^^^^^^^^^^^^^^^^^
%s is not a numerical conversion

> Or how to make hex-output with filling '0' instead
> of ' ' for two-char length strings?

   Printf.sprintf "%02X" 12

You have to tell the length here otherwise no filling is necessary.

ChriS


  parent reply	other threads:[~2007-02-04 10:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-04  1:00 sprintf-Bug? Oliver Bandel
2007-02-04  1:11 ` [Caml-list] sprintf-Bug? Jonathan Roewen
2007-02-04  1:51   ` Oliver Bandel
2007-02-04  1:55     ` Jonathan Roewen
     [not found]     ` <45C53E45.1080109@rftp.com>
2007-02-04  2:08       ` Oliver Bandel
2007-02-04  2:11         ` Jonathan Roewen
2007-02-04 12:43           ` Oliver Bandel
2007-02-04 10:41     ` Christophe TROESTLER [this message]
     [not found] <20070204020819.B999DBC6F@yquem.inria.fr>
2007-02-04 10:04 ` David Allsopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070204.114145.182918936.Christophe.Troestler+ocaml@umh.ac.be \
    --to=christophe.troestler+ocaml@umh.ac.be \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).