Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pbFormatInt(int, digits = 3)
- int = int.to_i if !int.is_a?(Numeric)
- strInt = int.round.to_s
- numLeading = digits-strInt.length
- return strInt if numLeading <= 0
- leadingZeroes = "0" * numLeading
- return leadingZeroes + strInt
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement