Format the passed number, added commas for the decimal parts.
<p/>
Created on Dec 3, 2008 by depryf
@param num number to format
@return formatted number
503246
public static String formatNumber(int num) {
        DecimalFormat format = new DecimalFormat();
        format.setDecimalSeparatorAlwaysShown(false);
        return format.format(num);
    }
1012663
function formatNumber(value, options) {
    options = options || {};
    value += ''; // must be String Type

    // not a number !!
    if (!__isNumber(value)) {
        return false;
    }

    var valueArr = __splitValue(value),
        integer = valueArr[0],
        negative = integer < 0,
        absInteger = Math.abs(integer) + '',
        formattedValue;

    if (options.reduce) {
        if (absInteger >= 100000 && absInteger <= 999999) {
            options.prefix = 'k' + options.prefix;
            integer = integer.slice(0, -3);
        } else if (absInteger > 999999 && absInteger <= 9999999) {
            options.prefix = 'Mio ' + options.prefix;
            integer = negative ? '-' + absInteger[0] + ',' + absInteger[1] : absInteger[0] + ',' + absInteger[1];
        } else if (absInteger > 9999999 && absInteger <= 999999999) {
            options.prefix = 'Mio ' + options.prefix;
            integer = integer.slice(0, -6);
        } else if (absInteger > 999999999 && absInteger <= 9999999999) {
            options.prefix = 'Mrd ' + options.prefix;
            integer = integer.slice(0, -8);
            integer = negative ? '-' + absInteger[0] + ',' + absInteger[1] : absInteger[0] + ',' + absInteger[1];
        } else if (absInteger > 9999999999) {
            options.prefix = 'Mrd ' + options.prefix;
            integer = integer.slice(0, -9);
        }

        // add spaces
        formattedValue = __addSpacesSeparator(integer);
    } else {
        // add spaces
        valueArr[0] = __addSpacesSeparator(integer);
        formattedValue = valueArr.join(',');
    }

    if (options.prefix) {
        formattedValue += ' ' + options.prefix;
    }

    return formattedValue;
}
601215
public static String format(ITemplate template, Number number) {
        return format(template, number, null, null);
    }
1229512
public static String format(double[][] m, NumberFormat nf) {
    return formatTo(new StringBuilder().append("[\n"), m, " [", "]\n", ", ", nf).append("]").toString();
  }
995609
static function format_number($number) {
        $formatted = rtrim(format_float($number, 4),'0');
        if (substr($formatted, -1)==get_string('decsep', 'langconfig')) { //if last char is the decimal point
            $formatted .= '0';
        }
        return $formatted;
    }
575531
@SuppressWarnings("squid:S3655")
    public String getNummerFormatted() {
        if (!this.getNummer().isPresent()) {
            throw new IllegalStateException("no number present");
        }
        BigInteger hundert = BigInteger.valueOf(100);
        StringBuilder formatted = new StringBuilder();
        for (BigInteger i = this.getNummer().get(); i.compareTo(BigInteger.ONE) > 0; i = i.divide(hundert)) {
            formatted.insert(0, " " + i.remainder(hundert));
        }
        return formatted.toString().trim();
    }
490886
public String format(Locale locale, double number) {
	DecimalFormat df = getDecimalFormat(locale);
	df.applyPattern(",0");
	df.setGroupingSize(3);
	return df.format(number);
    }
521250
def _format_nsn(number, metadata, num_format, carrier_code=None):
    """"""
    # Note in some regions, the national number can be written in two
    # completely different ways depending on whether it forms part of the
    # NATIONAL format or INTERNATIONAL format. The num_format parameter here
    # is used to specify which format to use for those cases. If a carrier_code
    # is specified, this will be inserted into the formatted string to replace
    # $CC.
    intl_number_formats = metadata.intl_number_format

    # When the intl_number_formats exists, we use that to format national
    # number for the INTERNATIONAL format instead of using the
    # number_desc.number_formats.
    if (len(intl_number_formats) == 0 or
        num_format == PhoneNumberFormat.NATIONAL):
        available_formats = metadata.number_format
    else:
        available_formats = metadata.intl_number_format
    formatting_pattern = _choose_formatting_pattern_for_number(available_formats, number)
    if formatting_pattern is None:
        return number
    else:
        return _format_nsn_using_pattern(number, formatting_pattern, num_format, carrier_code)
725323
private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){
		if( num.doubleValue() == Math.round(num.doubleValue()) ){
			// Integer
			if( null != numFormat ){
				pw.print( numFormat.format(num.intValue()) );
			} else {
				pw.print( num.intValue() );
			}
			
		} else {
			if( null != numFormat ){
				pw.print( numFormat.format(num) );
			} else {
				pw.print( num );
			}
		}
	}
1107705
private String formatUnits(Number value)
   {
      return (value == null ? null : m_formats.getUnitsDecimalFormat().format(value.doubleValue() / 100));
   }
457486
public function set_num_format($num_format) {
        $numbers = array();

        $numbers[1] = '0';
        $numbers[2] = '0.00';
        $numbers[3] = '#,##0';
        $numbers[4] = '#,##0.00';
        $numbers[11] = '0.00E+00';
        $numbers[12] = '# ?/?';
        $numbers[13] = '# ??/??';
        $numbers[14] = 'mm-dd-yy';
        $numbers[15] = 'd-mmm-yy';
        $numbers[16] = 'd-mmm';
        $numbers[17] = 'mmm-yy';
        $numbers[22] = 'm/d/yy h:mm';
        $numbers[49] = '@';

        if ($num_format !== 0 and in_array($num_format, $numbers)) {
            $this->format['numberformat']['code'] = $num_format;
        }

        if (!isset($numbers[$num_format])) {
            return;
        }

        $this->format['numberformat']['code'] = $numbers[$num_format];
    }
585493
public static String formatPluralCurrency(final Number value)
    {
        DecimalFormat decf = context.get().getPluralCurrencyFormat();
        return stripZeros(decf, decf.format(value));
    }
390582
function convertFormatNumber (value, num) {
  // 序数
  if (num === 0) {
    return suji(value, '序数');
  }
  // 0埋め
  if (typeof value === 'number') {
    value = value + '';
    return value.length < num ? ('000000000' + value).slice(-num) : value;
  }
  // 切り捨て
  return num && num < value.length ? value.substring(0, num) : value;
}
73994
function(num) {
		var v = new Number(num);
		if (v) {
			if (v.toLocaleString) {
				return v.toLocaleString();
			} else {
				return String(num).replace( /(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
			}
		}
		return num;
	}
904344
private Format decimalFormat(int fractionPrecision) {
		DecimalFormat format;
		if (fractionPrecision == 0) {
			format = new DecimalFormat("###0");
		} else if (fractionPrecision > 0) {
			StringBuilder formatSb = new StringBuilder();
			formatSb.append("###0.");
			appendChars(formatSb, ZERO_CHARS, fractionPrecision);
			format = new DecimalFormat(formatSb.toString());
		} else {
			format = new DecimalFormat("###0.###");
		}
		return format;
	}
94835
function commafy (num, options) {
  num = ('' + num).replace(/,/g, '')
  if (num) {
    var opts = baseExports.assign({ spaceNumber: 3, separator: ',' }, options)
    var optFixed = opts.fixed
    var result = (optFixed ? stringToNumber(num).toFixed(optFixed) : num).split('.')
    return result[0].replace(new RegExp('(?=(?!(\\b))(\\d{' + opts.spaceNumber + '})+$)', 'g'), opts.separator) + (result[1] ? '.' + result[1] : '')
  }
  return num
}
195734
public static boolean isNumber(final String num) {
    if (num == null || num.length() == 0) {
      return false;
    }
    final boolean firstIsDigit = Character.isDigit(num.charAt(0));
    if (!firstIsDigit && num.charAt(0) != '-') {
      return false;
    }
    boolean dig = firstIsDigit;
    for (int i = 1; i < num.length(); i++) {
      if (!Character.isDigit(num.charAt(i))) {
        return false;
      }
      dig = true;
    }
    return dig;
  }