On Thursday, March 12, 2015 10:41:40 AM Austin Ziegler wrote:
> This is covered well in the documentation on sprintf (ri sprintf or man 2
> printf).
> 
> >> "%.2f" % 13.5
> => "13.50"
> >> "%d.%02d" % (13.5 * 100).divmod(100)
> => "13.50"
> 

I never said I'm working on _float_ point numbers. I just said, you can do left _padd_ with `sprintf` or `String#%` I'm sure. But I am not sure, right padding is possible or not. Like :

Thu Mar 12 21:04:42 IST 2015
[arup@~]$ irb
[1] pry(main)> "%4s" % "a"
=> "   a"
[2] pry(main)> "%4d" % "1"
=> "   1"
[3] pry(main)> "%40d" % "1"
=> "                                       1"
[4] pry(main)> "%04d" % "1"
=> "0001"
[5] pry(main)>

I also know right padding is possible using `String#ljust` like :

[5] pry(main)> "a".ljust(4, " ")
=> "a   "
[6] pry(main)> "1".ljust(4, " ")
=> "1   "
[7] pry(main)> "1".ljust(4, '0')
=> "1000"
[8] pry(main)>


Just wanted to know is this really not possible  using `String#%` or `#sprintf` ? 

-- 
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

--Brian Kernighan