method
number_to_percentage
v1.1.6 -
Show latest stable
- Class:
ActionView::Helpers::NumberHelper
number_to_percentage(number, options = {})public
Formats a number as into a percentage string. The options hash can be used to customize the format of the output. The number can contain a level of precision using the precision key; default is 3 The unit separator can be set using the separator key; default is "." Examples:
number_to_percentage(100) => 100.000% number_to_percentage(100, {:precision => 0}) => 100% number_to_percentage(302.0574, {:precision => 2}) => 302.06%