Parses Style#add_style options for number formatting.
 noop if neither :format_code or :num_format options are set.
 @option options [Hash] A hash describing the :format_code and/or :num_fmt integer for the style.
 @return [NumFmt|Integer]
12349
def parse_num_fmt_options(options={})
      return if (options.keys & [:format_code, :num_fmt]).empty?

      #When the user provides format_code - we always need to create a new numFmt object
      #When the type is :dxf we always need to create a new numFmt object
      if options[:format_code] || options[:type] == :dxf
        #If this is a standard xf we pull from numFmts the highest current and increment for num_fmt
        options[:num_fmt] ||= (@numFmts.map{ |num_fmt| num_fmt.numFmtId }.max + 1) if options[:type] != :dxf
        numFmt = NumFmt.new(:numFmtId => options[:num_fmt] || 0, :formatCode=> options[:format_code].to_s)
        options[:type] == :dxf ? numFmt : (numFmts << numFmt; numFmt.numFmtId)
      else
        options[:num_fmt]
      end
    end
572497
def num(self, num, h=None, to_x=None, format="%.2f", change_style=None, change_size=None):
        
        self.txt(format % num, h=h, to_x=to_x, change_style=change_style, change_size=change_size)
955456
function(val)
    {
      var numberOptions =
      {
        style: "currency",
        currency: currency,
        minimumFractionDigits: 0,
        maximumFractionDigits: 0
      }

      return formatNumber(val == null || val === "" || isNaN(val) ? 0 : val, numberOptions)
    }
510278
def add_page_numbering
      numbering_options = {
        at: [@pdf.bounds.right - 150, 0-@format[:footer_size]],
        width: 150,
        align: :right,
        start_count_at: 1,
        color: "999999",
        size: 8
      }
      @pdf.number_pages "Page <page> of <total>", numbering_options
    end
510706
function parseCellStyle(xf, numFmts) {
  const style = {}
  if (xf.hasAttribute('numFmtId')) {
    const numberFormatId = xf.getAttribute('numFmtId')
    if (numFmts[numberFormatId]) {
      style.numberFormat = numFmts[numberFormatId]
    } else {
      style.numberFormat = { id: numberFormatId }
    }
  }
  return style
}
1042256
def format_number(num, singular = nil, plural = nil)
      bold_num = ::Cinch::Formatting.format(:bold, num.to_s)
      (bold_num + ' ' + (num == 1 ? singular : plural).to_s).strip
    end
503246
public static String formatNumber(int num) {
        DecimalFormat format = new DecimalFormat();
        format.setDecimalSeparatorAlwaysShown(false);
        return format.format(num);
    }
487109
public function numberFormat()
    {
        $num = (float) ((string) $this->getRequiredParameter('number'));
        $decimals = intval((string)$this->getParameter('decimals'));
        return number_format($num, $decimals);
    }
268014
def format
      raise FormatError.new(self) unless formattable?

      REXML::Element.new(type).tap do |attribute|
        attribute.attributes["key"] = @key
        attribute.attributes["value"] = format_value
        meta.each {|m| attribute.elements << m.format if m.formattable?}
      end
    end
277752
public void formatCurrency(
      BigDecimal n, CLDR.Currency currencyCode, StringBuilder destination, CurrencyFormatOptions options) {
    
    DigitBuffer dbuf = new DigitBuffer();
    CurrencyFormatStyle style = options.style();
    NumberFormatMode formatMode = orDefault(options.formatMode(), NumberFormatMode.DEFAULT);
    boolean grouping = orDefault(options.grouping(), true);
    int currencyDigits = getCurrencyDigits(currencyCode);

    switch (style) {
      case SYMBOL:
      case ACCOUNTING:
      {
        NumberPattern[] patterns = style == CurrencyFormatStyle.SYMBOL ? currencyStandard : currencyAccounting;
        NumberPattern pattern = select(n, patterns);
        String symbol = options.symbolWidth() == CurrencySymbolWidth.NARROW 
            ? getNarrowCurrencySymbol(currencyCode) : getCurrencySymbol(currencyCode);
        DigitBuffer other = new DigitBuffer();
        setup(params, pattern, n, other, options, symbol, formatMode, grouping, currencyDigits, -1, -1);
        format(pattern, other, dbuf, symbol, null);
        dbuf.appendTo(destination);
        break;
      }

      case SHORT:
      {
        NumberFormatContext ctx = new NumberFormatContext(options, SIGNIFICANT_MAXFRAC, currencyDigits);
        int nDigits = integerDigits(n);
        int nDivisor = getDivisor_CURRENCY_SHORT(nDigits);

        // Q1 is the number divided by the divisor (if any).
        BigDecimal q1 = n;
        if (nDivisor > 0) {
          q1 = n.movePointLeft(nDivisor).stripTrailingZeros();
        }
        int q1Digits = integerDigits(q1);

        // Select an initial pattern using the OTHER plural category.
        NumberPattern pattern = select(n, getPattern_CURRENCY_SHORT(nDigits, PluralCategory.OTHER));
        
        // Q2 is the number adjusted using the pattern and options.
        ctx.setCompact(pattern, q1Digits, nDivisor);
        BigDecimal q2 = ctx.adjust(q1);
        int q2Digits = integerDigits(q2);

        // Number rounded up, we need to select a new divisor and pattern.
        if (q2Digits > q1Digits) {
          // Bump the number of digits by 1 to select the next divisor/pattern.
          nDigits++;
          int divisor = getDivisor_CURRENCY_SHORT(nDigits);
          pattern = select(n, getPattern_CURRENCY_SHORT(nDigits, PluralCategory.OTHER));
          
          // If divisor changed, we need to divide and adjust again. 
          // Otherwise we just use Q2 as-is.
          if (divisor > nDivisor) {
            q1 = n.movePointLeft(divisor).stripTrailingZeros();
            ctx.setCompact(pattern, integerDigits(q1), divisor);
            q2 = ctx.adjust(q1);
          }
        }

        // Compute the plural category.
        NumberOperands operands = new NumberOperands(q2.toPlainString());
        PluralCategory category = PLURAL_RULES.evalCardinal(bundleId.language(), operands);

        // Select the final pluralized pattern.
        pattern = select(n, getPattern_CURRENCY_SHORT(nDigits, category));
        
        // Format the number into the buffer.
        String symbol = getCurrencySymbol(currencyCode);
        DigitBuffer number = new DigitBuffer();
        NumberFormattingUtils.format(q2, number, params, true, grouping, 
            pattern.format.minimumIntegerDigits,
            currencyStandard[0].format.primaryGroupingSize, 
            currencyStandard[0].format.secondaryGroupingSize);
        
        // Format the entire pattern and append to destination.
        format(pattern, number, dbuf, symbol, null);
        dbuf.appendTo(destination);
        break;
      }
      
      case NAME:
      case CODE:
      {
        // Format the number with generic formatter parameters and grouping off to get the plural category.
        NumberPattern pattern = select(n, decimalStandard);
        DigitBuffer number = new DigitBuffer();
        setup(GENERIC_PARAMS, pattern, n, number, options, null, formatMode, false, currencyDigits, -1, -1);
        
        // Set the operands and get the plural category.
        NumberOperands operands = new NumberOperands(number);
        PluralCategory category = PLURAL_RULES.evalCardinal(bundleId.language(), operands);
        number.reset();

        // Format the number
        setup(params, pattern, n, number, options, null, formatMode, grouping, currencyDigits, -1, -1);
        format(pattern, number, dbuf, null, null);
        
        // Wrap the result with the wrapper selected by the plural category.
        String unit = style == CurrencyFormatStyle.CODE 
            ? currencyCode.toString() 
            : getCurrencyPluralName(currencyCode, category);
        wrapUnits(category, dbuf, unit, destination);
        break;
      }
    }
  }
1373124
def format national_number, options = {}
      type         = options[:format]       || @format
      space        = options[:spaces]       || @space       || @@default_space
      local_space  = options[:local_spaces] || @local_space || space           || @@default_local_space
      parentheses  = options[:parentheses]
      parentheses  = @parentheses || @@default_parentheses if parentheses.nil?
      use_trunk    = options[:trunk]
      
      trunk, ndc, *local_pieces = split national_number
      
      local = format_local local_pieces, local_space
      
      format_cc_ndc trunk, ndc, local, type, space, parentheses, use_trunk
    end
409475
protected NumberFormat guessNumberFormat(int style) {
        NumberFormat result;
        ULocale nfLocale = getAvailableLocale(TYPE_NUMBERFORMAT);
        if (nfLocale == null) {
            nfLocale = ULocale.ROOT;
        }
        switch (style) {
        case NF_NUMBER:
            result = NumberFormat.getInstance(nfLocale);
            break;
        case NF_SCIENTIFIC:
            result = NumberFormat.getScientificInstance(nfLocale);
            break;
        case NF_INTEGER:
            result = NumberFormat.getIntegerInstance(nfLocale);
            break;
        case NF_PERCENT:
            result = NumberFormat.getPercentInstance(nfLocale);
            break;
        case NF_CURRENCY:
            result = NumberFormat.getCurrencyInstance(nfLocale);
            result.setCurrency(getCurrency());
            break;
        default:
            throw new IllegalArgumentException("Unknown number format style");
        }
        return result;
    }
835321
def format(target)
      begin
        number = number_with_precision(target, @precision)
        parts = number.split('.')
        if parts.at(1).nil?
          parts[0] + "%"
        else
          parts[0] + @separator + parts[1].to_s + "%"
        end
      rescue
        target
      end
    end
226592
def set_format_options(fmt, format_options):
    """"""
    if not format_options:
        return

    for opt in format_options:
        try:
            key, value = opt.split('=')
        except ValueError:
            raise ValueError("Format options are expected to be of the form key=value, not '{}'".format(opt))

        if key not in _VALID_FORMAT_OPTIONS:
            raise ValueError("'{}' is not a valid format option. Expected one of '{}'"
                             .format(key, "', '".join(_VALID_FORMAT_OPTIONS)))

        if key in _BINARY_FORMAT_OPTIONS:
            value = str2bool(value)

        fmt[key] = value
1151200
def format_value(value,number_format):
    ""

    style,sufix,scale = decode_format(number_format)
    fmt = "{0:" + style + "}" + sufix

    return fmt.format(scale * value)
1186396
function parseOptions(options) {
    return {
        boolean: "boolean" in options ? options.boolean : true,
        number: "number" in options ? options.number : true,
        string: "string" in options ? options.string : true,
        allow: options.allow || []
    };
}
136956
private int getStyleKey(Map<String, Object> style, BandElement bandElement) {  
    	final int prime = 31;
    	int hashCode = getFontKey(style);   	
    	if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) {    		
            Color val = (Color) style.get(StyleFormatConstants.BACKGROUND_COLOR);
            hashCode = prime*hashCode + val.hashCode() * 3;
        }
        if (style.containsKey(StyleFormatConstants.HORIZONTAL_ALIGN_KEY)) {        	
            String val = (String) style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY);
            hashCode = prime*hashCode +  + val.hashCode();
        }
        if (style.containsKey(StyleFormatConstants.VERTICAL_ALIGN_KEY)) {        
        	String val = (String) style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY);
            hashCode = prime*hashCode + val.hashCode();
        }
        if (style.containsKey(StyleFormatConstants.BORDER_LEFT)) {        	
        	Float val = (Float) style.get(StyleFormatConstants.BORDER_LEFT) * 23;
        	hashCode = prime*hashCode + val.hashCode();
        }
        if (style.containsKey(StyleFormatConstants.BORDER_RIGHT)) {        
        	Float val = (Float) style.get(StyleFormatConstants.BORDER_RIGHT) * 29;
        	hashCode = prime*hashCode + val.hashCode();
        }
        if (style.containsKey(StyleFormatConstants.BORDER_TOP)) {        	
        	Float val = (Float) style.get(StyleFormatConstants.BORDER_TOP) * 31;
        	hashCode = prime*hashCode + val.hashCode();
        }
        if (style.containsKey(StyleFormatConstants.BORDER_BOTTOM)) {        	
        	Float val = (Float) style.get(StyleFormatConstants.BORDER_BOTTOM) * 37;
        	hashCode = prime*hashCode + val.hashCode();
        }        
        if (style.containsKey(StyleFormatConstants.BORDER_LEFT_COLOR)) {        	
        	Color val = (Color) style.get(StyleFormatConstants.BORDER_LEFT_COLOR);
        	hashCode = prime*hashCode + val.hashCode() * 5;
        }
        if (style.containsKey(StyleFormatConstants.BORDER_RIGHT_COLOR)) {        	
        	Color val = (Color) style.get(StyleFormatConstants.BORDER_RIGHT_COLOR);
        	hashCode = prime*hashCode + val.hashCode() * 7;
        }
        if (style.containsKey(StyleFormatConstants.BORDER_TOP_COLOR)) {        
        	Color val = (Color) style.get(StyleFormatConstants.BORDER_TOP_COLOR);
        	hashCode = prime*hashCode +  val.hashCode() * 11;
        }
        if (style.containsKey(StyleFormatConstants.BORDER_BOTTOM_COLOR)) {        	
        	Color val = (Color) style.get(StyleFormatConstants.BORDER_BOTTOM_COLOR);
        	hashCode = prime*hashCode + val.hashCode() * 13;
        }
        if (style.containsKey(StyleFormatConstants.PATTERN)) {        	
        	String val = (String) style.get(StyleFormatConstants.PATTERN);        	
        	hashCode = prime*hashCode + val.hashCode() * 17;
        }
        
        if (bandElement != null) {
        	hashCode = prime*hashCode + bandElement.hashCode();
        }	
        return hashCode;
    }