ActionView::Helpers::NumberHelper

number_with_delimiter

API docs (Rails 8.1.4.1) ↗
def number_with_delimiter(number, options = {})

Description

Formats the number with a thousands delimiter.

Arguments

Changing a value updates the ERB and HTML.

Converts the number to a string using ActiveSupport::NumberHelper. A non-numeric value ("abc") is returned as is instead of raising an error. Returns nil for nil.
options= {}
" "
The string to use as the thousands delimiter. The given string is escaped.
","
The string to use as the decimal separator. The given string is escaped.
/(\d+?)(?=(\d\d)+(\d)(?!\d))/
A regular expression that determines where delimiters are inserted (the one on this page uses Indian-style grouping, as in 12,34,567).
true raises InvalidNumberError when the number argument is not a number.
Options not listed here do not become HTML attributes. With :locale, uses that language's number format translations (number.format, etc.). This site provides no number format translations, so :ja gets Rails' built-in English format (a language this site does not have raises I18n::InvalidLocale).

ERB

Changes from the previous output: Added Removed Changed


          

HTML