Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- class Integer
- def jpy_comma
- self.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\1,')
- end
- end
- def int_str?(s)
- Integer(s)
- true
- rescue ArgumentError
- false
- end
- v = ARGV[0]
- if int_str?(v)
- atm = ((v.to_f / 125).round) * 125
- puts "%s --> ATM:%s" % [v.to_i.jpy_comma, atm.jpy_comma]
- else
- atm = "error"
- puts "error"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement