Returns a string representation of the number passed in where groups of three digits are delimited by comma

@param number Input number
@return formatted String
969698
public static String formatNumber(long number) {
        String stringRepresentation = Long.toString(number);
        StringBuilder sb = new StringBuilder();
        int bound = stringRepresentation.length() - 1;
        String delimiter = ",";
        int counter = 0;
        for (int i = bound; i >= 0; i--) {
            char c = stringRepresentation.charAt(i);
            if (i != bound && counter % 3 == 0) {
                sb.append(delimiter);
            }
            sb.append(c);
            counter++;
        }
        return sb.reverse().toString();
    }
6255
public static String numberToString(Number number) throws JSONException {
		if (number == null) {
			throw new JSONException("Number must be non-null");
		}

		double doubleValue = number.doubleValue();
		JSON.checkDouble(doubleValue);

		// the original returns "-0" instead of "-0.0" for negative zero
		if (number.equals(NEGATIVE_ZERO)) {
			return "-0";
		}

		long longValue = number.longValue();
		if (doubleValue == longValue) {
			return Long.toString(longValue);
		}

		return number.toString();
	}
155927
function commaNumber(inputNumber, optionalSeparator, optionalDecimalChar) {

  // we'll strip off and hold the decimal value to reattach later.
  // we'll hold both the `number` value and `stringNumber` value.
  let number, stringNumber, decimal

  // default `separator` is a comma
  const separator = optionalSeparator   || ','

  // default `decimalChar` is a period
  const decimalChar = optionalDecimalChar || '.'

  switch (typeof inputNumber) {

    case 'string':

      // if there aren't enough digits to need separators then return it
      // NOTE: some numbers which are too small will get passed this
      //       when they have decimal values which make them too long here.
      //       but, the number value check after this switch will catch it.
      if (inputNumber.length < (inputNumber[0] === '-' ? 5 : 4)) {
        return inputNumber
      }

      // remember it as a string in `stringNumber` and convert to a Number
      stringNumber = inputNumber

      // if they're not using the Node standard decimal char then replace it
      // before converting.
      number = decimalChar !== '.' ? Number(stringNumber.replace(decimalChar, '.'))
                                   : Number(stringNumber)
      break

    // convert to a string.
    // NOTE: don't check if the number is too small before converting
    //       because we'll need to return `stringNumber` anyway.
    case 'number':
      stringNumber = String(inputNumber)
      number       = inputNumber
      break

    // return invalid type as-is
    default: return inputNumber
  }

  // when it doesn't need a separator or isn't a number then return it
  if ((-1000 < number && number < 1000) || isNaN(number) || !isFinite(number)) {
    return stringNumber
  }

  // strip off decimal value to append to the final result at the bottom
  let decimalIndex = stringNumber.lastIndexOf(decimalChar)

  if (decimalIndex > -1) {
    decimal = stringNumber.slice(decimalIndex)
    stringNumber = stringNumber.slice(0, -decimal.length)
  }

  // else {
  //   decimal = null
  // }

  // finally, parse the string and add in separators
  stringNumber = parse(stringNumber, separator)

  // if there's a decimal value add it back on the end.
  // NOTE: we sliced() it off including the decimalChar, so it's good.
  return decimal ? stringNumber + decimal : stringNumber

}
297643
public String getDecimalPart(final int digit) {
        
        final int length = decimalPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        return String.valueOf(decimalPart.charAt(digit-1));
        
    }
490886
public String format(Locale locale, double number) {
	DecimalFormat df = getDecimalFormat(locale);
	df.applyPattern(",0");
	df.setGroupingSize(3);
	return df.format(number);
    }
1131836
static public String byteToLit(final String number)
    {
        final byte aByte = (byte) Integer.parseInt(number);

        if (aByte < ByteLiteral.length)
            return ByteLiteral[aByte];
        return "" + (int) aByte;
    }
517109
public StringBuffer format(long number, StringBuffer toAppendTo,
                               FieldPosition status) {
        return format((double)number, toAppendTo, status);
    }
505954
function numberWithCommas(n) {
  const parts = n.toString().split('.');
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  return parts.join('.');
}
272154
public String getIntegerPart(final int digit) {
        
        final int length = integerPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        String num = String.valueOf(integerPart.charAt(length - digit));
        if(isUseSeparator()) {
            if(digit >= 4 && (digit-1) % 3 == 0) {
                num += ",";
            }
        }
        
        return num;
        
    }
451288
public function number($number)
    {
        if ($number < 0) {
            $number   = -$number;
            $negative = self::NEGATIVE;
        } else {
            $negative = '';
        }
        $parts    = explode(self::DECIMAL, (string) $number, 2);
        $integers = $parts[0];
        if (strlen($integers) >= $this->digitsFirstGroup() + $this->minimumGroupingDigits()) {
            $todo     = substr($integers, 0, -$this->digitsFirstGroup());
            $integers = self::GROUP . substr($integers, -$this->digitsFirstGroup());
            while (strlen($todo) >= $this->digitsGroup() + $this->minimumGroupingDigits()) {
                $integers = self::GROUP . substr($todo, -$this->digitsGroup()) . $integers;
                $todo     = substr($todo, 0, -$this->digitsGroup());
            }
            $integers = $todo . $integers;
        }
        if (count($parts) > 1) {
            $decimals = self::DECIMAL . $parts[1];
        } else {
            $decimals = '';
        }

        return $this->digits($negative . $integers . $decimals);
    }
50579
public static long parseLong(String number) {
		if (StrUtil.isBlank(number)) {
			return 0;
		}

		// 对于带小数转换为整数采取去掉小数的策略
		number = StrUtil.subBefore(number, CharUtil.DOT, false);
		if (StrUtil.isEmpty(number)) {
			return 0;
		}

		if (number.startsWith("0x")) {
			// 0x04表示16进制数
			return Long.parseLong(number.substring(2), 16);
		}

		return Long.parseLong(removeNumberFlag(number));
	}
1106615
public String ordinalize(int number) {
        String numberStr = Integer.toString(number);
        if (11 <= number && number <= 13) return numberStr + "th";
        int remainder = number % 10;
        if (remainder == 1) return numberStr + "st";
        if (remainder == 2) return numberStr + "nd";
        if (remainder == 3) return numberStr + "rd";
        return numberStr + "th";
    }
817486
public static String formatBigDecimal(BigDecimal number) {
		if (number.signum() != -1) {
			return "+" + number.toString();
		} else {
			return number.toString();
		}
	}
1191226
private Number parseNumber(String string) {
		if (string.length() > 2 && string.charAt(0) == '0' && string.charAt(1) == 'x') {
			return Long.parseLong(string.substring(2), 16);
		}
		return Double.parseDouble(string);
	}
1291728
public final String format(long number) {
        StringBuffer buf = new StringBuffer(19);
        FieldPosition pos = new FieldPosition(0);
        format(number, buf, pos);
        return buf.toString();
    }
1130224
def format_number(number, format):
    """"""
    if format == NumberFormat.NUMBER:
        return str(number)
    elif format == NumberFormat.LOWERCASE_CHARACTER:
        string = ''
        while number > 0:
            number, ordinal = divmod(number, 26)
            if ordinal == 0:
                ordinal = 26
                number -= 1
            string = chr(ord('a') - 1 + ordinal) + string
        return string
    elif format == NumberFormat.UPPERCASE_CHARACTER:
        return format_number(number, 'lowercase character').upper()
    elif format == NumberFormat.LOWERCASE_ROMAN:
        return romanize(number).lower()
    elif format == NumberFormat.UPPERCASE_ROMAN:
        return romanize(number)
    elif format == NumberFormat.SYMBOL:
        return symbolize(number)
    elif format == NumberFormat.NONE:
        return ''
    else:
        raise ValueError("Unknown number format '{}'".format(format))
654084
public String getWholeNumberPartAfter(final int digit) {
        
        final int length = wholeNumberPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        return wholeNumberPart.substring(0, (length - digit + 1));
    }