目的
整数部をカンマ区切りで表示し、小数点以下を表示したい
コード
number_with_precision(123456789, precision: 2, delimiter: ',')
#=> "123,456,789.00"
参考リンク
ruby-on-rails — 大きな数字にカンマを追加するためのRailsトリックはありますか?
ActionView::Helpers::NumberHelper
Go to list of users who liked
More than 3 years have passed since last update.
整数部をカンマ区切りで表示し、小数点以下を表示したい
number_with_precision(123456789, precision: 2, delimiter: ',')
#=> "123,456,789.00"
ruby-on-rails — 大きな数字にカンマを追加するためのRailsトリックはありますか?
ActionView::Helpers::NumberHelper
Register as a new user and use Qiita more conveniently
Go to list of users who liked