Bernard Kenik
11/14/2006 1:43:00 AM
----- Original Message -----
From: "Yukihiro Matsumoto" <matz@ruby-lang.org>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Sunday, November 12, 2006 6:34 PM
Subject: Re: sprintf bug (?)
> Hi,
>
> In message "Re: sprintf bug (?)"
> on Mon, 13 Nov 2006 07:03:44 +0900, Timothy Hunter
> <TimHunter@nc.rr.com> writes:
>
> |Possibly you meant "%010s" instead of "%10s"? In any case, I checked the
> |output of a C program compiled with gcc on my Powerbook running OS X
> |10.8. In this case, the '0' flag adds padding on the left:
>
> This is platform dependent. Linux manpage says:
>
> 0 The value should be zero padded. For d, i, o, u, x, X,
> a, A, e, E, f, F, g, and G conversions, the converted
> value is padded on the left with zeros rather than
> blanks. If the 0 and - flags both appear, the 0 flag is
> ignored. If a precision is given with a numeric
> conversion (d, i, o, u, x, and X), the 0 flag is
> ignored. For other conversions, the behavior is
> ~~~~~~~~~~~~~~~
> undefined.
> ~~~~~~~~~
>
> zero option affects some specifiers. %s is not among them.
>
> matz.
>
I suggest that the OP asks ruby's description of sprintf via "ri sprintf"
... it is essentially as described above