Add Zeroes Function in Ruby

Member

adelia_boyer

by adelia_boyer , in category: Ruby , 2 months ago

Add Zeroes Function in Ruby 😁

1
2
3
4
5
6
def self.add_zeroes(string, stringSize, leftOrRight = true)
  while string.size < stringSize
    string = leftOrRight ? "0" + string : string + "0"
  end
  string
end


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers