Re: Equivalent of Python zfill?


#1

fr Peter:

in Python this function is ‘’.zfill(5)

another possibility would be 5*‘0’

Equivalents in Ruby? I would be mainly interested in a zfill

equivalent

since that is faster that join or 5* imho.

same here.

irb(main):043:0> ‘0’*5
=> “00000”
irb(main):044:0> ‘0’*3
=> “000”