Decimal To Alphanumeric
@param  Integer
@param  Integer
@param  Boolean
@return String
971824
public static function decimalToAlphanumeric($number, $base = 64, $index = false)
    {
        if (!$base) {
            $base = strlen($index);
        } elseif (!$index) {
            $index = substr("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, $base);
        }

        $out = "";

        for ($i = floor(log10($number) / log10($base)); $i >= 0; $i--) { 
            $no = floor($num/pow($base, $i));
            $out = $out.substr($index, $no, 1);
            $number = $number - ($no * pow($base, $i));
        }
        return $out;
    }
1135304
public static function makeFromInteger($integer)
    {
        if ($integer == 0) return static::$chars[0];

        $number = abs($integer);

        if ($integer < 0)
            throw new \InvalidArgumentException("Can not encode for negative integers");

        $string = '';

        $base = strlen(static::$chars);

        while ($number > 0) {
            $string .= static::$chars[$number % $base];

            $number = (int) ($number / $base);
        }

        return strrev($string);
    }
1263147
public void encodeInteger(int n) throws IOException {
		// signalize sign
		if (n < 0) {
			encodeBoolean(true);
			// For negative values, the Unsigned Integer holds the
			// magnitude of the value minus 1
			encodeUnsignedInteger((-n) - 1);
		} else {
			encodeBoolean(false);
			encodeUnsignedInteger(n);
		}
	}
55084
function (valueString) {
			// TODO: Detect other number formats (e.g. comma as decimal separator)
			var valueComp = valueString.split('.');
			var integralPart = valueComp[0];
			var fractionalPart = valueComp[1] || "0";
			while (fractionalPart.length < 8) fractionalPart += "0";
			fractionalPart = fractionalPart.replace(/^0+/g, '');
			var value = BigInteger.valueOf(parseInt(integralPart));
			value = value.multiply(BigInteger.valueOf(100000000));
			value = value.add(BigInteger.valueOf(parseInt(fractionalPart)));
			return value;
		}
1359340
public final void mDecimalLiteral() throws RecognitionException {
		try {
			int _type = DecimalLiteral;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:16: ( ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )? )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )?
			{
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) )
			int alt5=2;
			int LA5_0 = input.LA(1);
			if ( (LA5_0=='0') ) {
				alt5=1;
			}
			else if ( ((LA5_0 >= '1' && LA5_0 <= '9')) ) {
				alt5=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 5, 0, input);
				throw nvae;
			}

			switch (alt5) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:19: '0'
					{
					match('0'); 
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:25: NonZeroDigit ( ( Digits )? | Underscores Digits )
					{
					mNonZeroDigit(); 

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:38: ( ( Digits )? | Underscores Digits )
					int alt4=2;
					int LA4_0 = input.LA(1);
					if ( (LA4_0=='_') ) {
						alt4=2;
					}

					else {
						alt4=1;
					}

					switch (alt4) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )?
							{
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )?
							int alt3=2;
							int LA3_0 = input.LA(1);
							if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) {
								alt3=1;
							}
							switch (alt3) {
								case 1 :
									// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: Digits
									{
									mDigits(); 

									}
									break;

							}

							}
							break;
						case 2 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:49: Underscores Digits
							{
							mUnderscores(); 

							mDigits(); 

							}
							break;

					}

					}
					break;

			}

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:70: ( IntegerTypeSuffix )?
			int alt6=2;
			int LA6_0 = input.LA(1);
			if ( (LA6_0=='L'||LA6_0=='l') ) {
				alt6=1;
			}
			switch (alt6) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
					{
					if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
						input.consume();
					}
					else {
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

			}

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
115277
def _convert_number(self, number):
        """"""

        number = float(number)
        return int(number) if number.is_integer() else float(number)
456835
public void formatDecimal(BigDecimal n, StringBuilder destination, DecimalFormatOptions options) {
    DigitBuffer dbuf = new DigitBuffer();
    DecimalFormatStyle style = options.style();
    boolean grouping = orDefault(options.grouping(), false);
    boolean currency = false;
    NumberFormatMode formatMode = orDefault(options.formatMode(), NumberFormatMode.DEFAULT);
    
    switch (style) {
      case DECIMAL:
      {
        NumberFormatContext ctx = new NumberFormatContext(options, NumberFormatMode.DEFAULT);
        NumberPattern pattern = select(n, decimalStandard);
        ctx.set(pattern);
        BigDecimal q = ctx.adjust(n);

        DigitBuffer number = new DigitBuffer();
        NumberFormattingUtils.format(q, number, params, currency, grouping,
            ctx.minIntDigits(),
            pattern.format.primaryGroupingSize(),
            pattern.format.secondaryGroupingSize());
        format(pattern, number, dbuf, null, null);
        dbuf.appendTo(destination);
        break;
      }

      case LONG:
      case SHORT:
      {
        NumberFormatContext ctx = new NumberFormatContext(options, NumberFormatMode.SIGNIFICANT);
        int nDigits = integerDigits(n);
        int nDivisor = getDivisor_DECIMAL_LONG(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;
        if (style == DecimalFormatStyle.LONG) {
          pattern = select(n, getPattern_DECIMAL_LONG(nDigits, PluralCategory.OTHER));
        } else {
          pattern = select(n, getPattern_DECIMAL_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_DECIMAL_LONG(nDigits);
          if (style == DecimalFormatStyle.LONG) {
            pattern = select(n, getPattern_DECIMAL_LONG(nDigits, PluralCategory.OTHER));
          } else {
            pattern = select(n, getPattern_DECIMAL_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.
        if (style == DecimalFormatStyle.LONG) {
          pattern = select(n, getPattern_DECIMAL_LONG(nDigits, category));
        } else {
          pattern = select(n, getPattern_DECIMAL_SHORT(nDigits, category));
        }
        
        // Format the number into the buffer.
        DigitBuffer number = new DigitBuffer();
        NumberFormattingUtils.format(q2, number, params, false, grouping, 
            pattern.format.minimumIntegerDigits, 
            decimalStandard[0].format.primaryGroupingSize, 
            decimalStandard[0].format.secondaryGroupingSize);
        
        // Format the entire pattern and append to destination.
        format(pattern, number, dbuf, null, null);
        dbuf.appendTo(destination);
        break;
      }
      
      case PERCENT:
      case PERCENT_SCALED:
      case PERMILLE:
      case PERMILLE_SCALED:
      {
        // In default modes, scale the number. Otherwise assume it is already scaled
        // appropriately.
        if (style == PERCENT || style == PERMILLE) {
          n = n.movePointRight(style == PERCENT ? 2 : 3);
        }
        String symbol = (style == PERCENT) || (style == PERCENT_SCALED) ? params.percent : params.perMille;
        NumberPattern pattern = select(n, percentStandard);
        DigitBuffer number = new DigitBuffer();
        setup(params, pattern, n, number, options, null, formatMode, grouping, -1, -1, -1);
        format(pattern, number, dbuf, null, symbol);
        dbuf.appendTo(destination);
        break;
      }
    }
  }
534996
private static function encodeInteger($integer)
    {
        if ($integer >= 0 && $integer < pow(2, 7)) {
            // positive fixnum: 7-bit positive integer
            // 0XXXXXXX
            return pack('H*', str_pad(dechex($integer), 2, 0, STR_PAD_LEFT));
        } elseif ($integer < 0 && abs($integer) < pow(2, 5)) {
            // negative fixnum: 5-bit negative integer
            // 111YYYYY
            return pack('H*', dechex(bindec(11100000) + $integer));
        }

        if ($integer >= 0) {
            $prefixes = array(8 => 0xcc00, 16 => 0xcd0000, 32 => 0xce00000000, 64 => 0xcf);
        } else {
            $prefixes = array(8 => 0xd000, 16 => 0xd10000, 32 => 0xd200000000, 64 => 0xd3);
        }

        // For each step the max size increases.
        foreach (array(8, 16, 32) as $power) {
            if ($integer < pow(2, $power)) {
                return pack('H*', dechex($prefixes[$power] + $integer));
            }
        }

        // 0x** ZZZZZZZZ ZZZZZZZZ ZZZZZZZZ ZZZZZZZZ ZZZZZZZZ ZZZZZZZZ ZZZZZZZZ ZZZZZZZZ
        return pack('H*', dechex($prefixes[64]).str_pad(dechex($integer), 16, '0', STR_PAD_LEFT));
    }
1065884
function (cell) {
      var num = cell.match(/\d+$/),
          alpha = cell.replace(num, '');

      return {
        alpha: alpha,
        num: parseInt(num[0], 10)
      }
    }
950963
function (mixed) {

            var type = typeof mixed;

            if (type === "boolean") {
                return +mixed;
            }

            mixed = "" + mixed;
            mixed = mixed.replace(/\s/g, "");
            mixed = mixed.replace(",", ".");
            mixed = (parseFloat(mixed) || 0);
            mixed = this.round(mixed, 9); // For numbers like "0.3000000004"

            return mixed;
        }
1194968
function stringToNumber(str, base) {
  var sanitized, isDecimal;
  sanitized = str.replace(fullWidthNumberReg, function(chr) {
    var replacement = getOwn(fullWidthNumberMap, chr);
    if (replacement === HALF_WIDTH_PERIOD) {
      isDecimal = true;
    }
    return replacement;
  });
  return isDecimal ? parseFloat(sanitized) : parseInt(sanitized, base || 10);
}
1218078
private static char digitToBasic(int digit, boolean uppercase) {
        /*  0..25 map to ASCII a..z or A..Z */
        /* 26..35 map to ASCII 0..9         */
        if(digit<26) {
            if(uppercase) {
                return (char)(CAPITAL_A+digit);
            } else {
                return (char)(SMALL_A+digit);
            }
        } else {
            return (char)((ZERO-26)+digit);
        }
    }
444164
private function baseEncode($integer)
    {
        $b      = 61;
        $base   = '123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $r      = $integer % $b;
        $result = $base[$r];
        $q      = floor($integer / $b);
        while ($q) {
            $r      = $q % $b;
            $q      = floor($q / $b);
            $result = $base[$r].$result;
        }

        return $result;
    }
151280
private static String convertLessThanOneThousand(int number) {
		String soFar;

		if (number % 100 < 20) {
			soFar = numNames[number % 100];
			number /= 100;
		} else {
			soFar = numNames[number % 10];
			number /= 10;

			soFar = tensNames[number % 10] + soFar;
			number /= 10;
		}
		if (number == 0) {
			return soFar;
		}
		return numNames[number] + " Hundred" + soFar;
	}
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;
}
556739
function(hexNum, alpha) {
            if(typeof hexNum !== "number") {
                hexNum = parseInt(hexNum, 16);
            }
            if(isNaN(hexNum) || hexNum < 0x000000 || hexNum > 0xffffff) {
                return undefined;
            }
            var r = (hexNum & 0xff0000) >> 16,
                g = (hexNum & 0x00ff00) >> 8,
                b = hexNum & 0x0000ff;

            return ((alpha === undefined) ? ("rgb(" + r + "," + g + "," + b + ")") : ("rgba(" + r + "," + g + "," + b + "," + alpha + ")"));
        }
249663
function formatNumber$1(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
    if (currency === void 0) { currency = null; }
    if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
    if (value == null)
        return null;
    // Convert strings to numbers
    value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value;
    if (typeof value !== 'number') {
        throw invalidPipeArgumentError(pipe, value);
    }
    var minInt;
    var minFraction;
    var maxFraction;
    if (style !== NumberFormatStyle.Currency) {
        // rely on Intl default for currency
        minInt = 1;
        minFraction = 0;
        maxFraction = 3;
    }
    if (digits) {
        var parts = digits.match(NUMBER_FORMAT_REGEXP);
        if (parts === null) {
            throw new Error(digits + " is not a valid digit info for number pipes");
        }
        if (parts[1] != null) { // min integer digits
            minInt = parseIntAutoRadix(parts[1]);
        }
        if (parts[3] != null) { // min fraction digits
            minFraction = parseIntAutoRadix(parts[3]);
        }
        if (parts[5] != null) { // max fraction digits
            maxFraction = parseIntAutoRadix(parts[5]);
        }
    }
    return NumberFormatter.format(value, locale, style, {
        minimumIntegerDigits: minInt,
        minimumFractionDigits: minFraction,
        maximumFractionDigits: maxFraction,
        currency: currency,
        currencyAsSymbol: currencyAsSymbol,
    });
}