NumberHelper

The NumberHelper class provides convenience methods for formatting numbers:

number_to_currency

Turns a number into a currency representation. You can select the :unit (denomination), :separator (normally .), :delimiter (normally , ), :format (whether the currency comes before or after the number), and :precision (normally 2).

number_to_human_size

Turns file-size byte counts into more typical human representations, like 12 GB.

number_to_percentage

Turns a number into a percent value. You can select the :precision (normally three digits after the decimal), and the :separator (normally .).

number_to_phone

Turns a number into an American-style telephone number. You can specify a country code, extension, delimiter, and whether or not the area code has parentheses, but you can’t specify how the numbers are broken down.

number_with_delimiter

Formats a number with a given :delimiter between thousands (, by default) and decimal :separator (. by default).

number_with_precision

Formats a number to present as many digits after the decimal point as are specified in the second argument (three is the default).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset