counter = 1; sprintf("%02d", counter) # => "01"

In general, the ruby String class is much better than Int class - 
because Strings are like everywhere in ruby. I believe Matz once said 
that the String class was most work (or devoured most manhours when he 
worked on ruby initially)
-- 
Posted via http://www.ruby-forum.com/.