Ruby on Rails Discussions
Formatting integer (2 printed as 02)
rubyonrails-talk
Thiago_Jackiw
(Thiago Jackiw)
March 28, 2007, 11:08pm
1
Yep, you can use sprintf:
sprintf("%0.2d", 4)
=> "04"
Related topics
Topic
Replies
Views
Activity
Formatting integer (2 printed as 02)
rubyonrails-talk
0
130
March 29, 2007
Formatting integer (2 printed as 02)
rubyonrails-talk
0
135
March 28, 2007
preceding zero
rubyonrails-talk
8
212
September 28, 2009
how to format floating point number
rubyonrails-talk
0
135
September 11, 2006
how to format floating point number
rubyonrails-talk
0
158
September 11, 2006