LoginSignup
2
3

More than 5 years have passed since last update.

半角数字を全角数字にする

Last updated at Posted at 2015-07-03
10.to_s.split(//).map{|s| %w(0 1 2 3 4 5 6 7 8 9)[s.to_i]}.join #=> "10"

なんかメソッドないのかな……

追記
diaphragmさんに以下のメソッドを教えて頂きました。

'12345'.tr('0-9', '0-9')

こちらのが楽ですね

2
3
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3