Format anything into integer.
@param mixed input
@return integer
431910
public static function toInteger($input = false) {

        if ($input && Validate::isNumber($input)) {

            $integer = (int) $input;
            if (Validate::isInteger($integer)) {

                return $integer;
            }
        }

        return false;
    }
404173
public static function studly($input)
    {
        $input = mb_convert_case($input, \MB_CASE_TITLE, 'UTF-8');
        $input = str_replace(array('-', '_'), ' ', $input);
        $input = str_replace(' ', '', $input);

        return $input;
    }
233136
public function decode($input)
    {
        $parts = explode('.', $input);

        foreach ($parts as &$part) {
            if (strpos($part, static::PREFIX) === 0) {
                $part = $this->_decodePart(
                    substr($part, strlen(static::PREFIX))
                );
            }
        }

        return implode('.', $parts);
    }
1342462
public function parse($input)
    {
        $sorting = new Sort();

        foreach (explode('|', $input) as $property) {
            if ($property[0] === '-') {
                $sorting->add(new Sort\Desc(substr($property, 1)));
                continue;
            }
            $sorting->add(new Sort\Asc($property));
        }

        return $sorting;
    }
1120056
public function format(array $input)
    {
        $output = $this->formatString;

        foreach ($input as $key => $value)
        {
            if (!isset($this->map[$key])) {
                continue;
            }

            if (is_array($value)) {
                $value = implode('\n\t', $value);
            }
            $output = str_replace($this->map[$key], $value, $output);
        }

        return $output;
    }
124684
public static function toFloat($input = false) {

        if ($input && Validate::isNumber($input)) {

            $float = (float) $input;
            if (Validate::isFloat($float)) {

                return $float;
            }
        }

        return false;
    }
800883
private static String formatInt(int number) {
        String str = Integer.toString(number);
        return number < 10 ? " " + str : str;
    }
400772
protected function getInputType($input)
    {
        // Get the formal type
        $type = gettype($input);

        // Check if it's numeric
        if ($type == 'integer' || $type == 'float' || $type == 'double')
            $type = 'numeric';

        // If it's something we don't check, null it
        if ($type == 'NULL' || $type == 'object' || $type == 'resource' || $type == 'undefined type')
            $type = null;

        // Check if it's an file array
        if ($type == 'array' && isset($input['type']) && $input['tmp_name'])
            $type = 'file';

        return $type;
    }
53186
public function convertFromNegative($input)
    {
        if (strpos('/*', $input[0]) !== false) {
            $input = substr($input, 1);
        }

        $input = strtr($input, static::NEGATIVE_CHARS, static::POSITIVE_CHARS);

        $res = $this->convertFromPositive($input);

        if (preg_match('/^0+$/', $res)) {
            return $res;
        }

        return '-' . $res;
    }
464340
private function tokenize($input, $limit = -1)
    {
        $chunks = preg_split('!\s+!', $input, $limit);
        if ($limit !== -1 && count($chunks) != $limit) {
            $chunks += array_fill(count($chunks), $limit, '');
        }
        return $chunks;
    }
1068342
public static function byte2intSplit($input)
    {
        $l = strlen($input);
        if ($l <= 0) {
            // right...
            return 0;
        } elseif (($l % 4) != 0) {
            // invalid input
            return false;
        }
        $result = array();
        for ($i = 0; $i < $l; $i += 4) {
            $int_build  = (ord($input[$i]) << 24);
            $int_build += (ord($input[$i+1]) << 16);
            $int_build += (ord($input[$i+2]) << 8);
            $int_build += (ord($input[$i+3]));
            $result[] = $int_build;
        }

        return $result;
    }
884000
public static function fromString(string $input): self
    {
        $data = explode('-', $input);
        if (!isset($data[0]) || !isset($data[1])) {
            throw new \InvalidArgumentException(
                    'Can not parse month from string "' . $input
                    . '", format should be "YYYY-MM"'
            );
        }

        list($year, $month) = $data;
        if (!ctype_digit($year)) {
            throw new \InvalidArgumentException(
                    'Detected value ' . $year . ' for year is not a valid year.'
            );
        }

        if (!ctype_digit($month) || 1 > $month || 12 < $month) {
            throw new \InvalidArgumentException(
                    'Detected value ' . $month . ' for month is not a valid month.'
            );
        }

        return new self($year, $month);
    }
1202593
public function genSalt($input = null)
    {
        if (!$input) {
            $input = $this->_getRandomBytes(12);
        }

        $identifier = $this->_identifier;

        $rounds = '';
        if ($this->_iterationCount != 5000) {
            $rounds = 'rounds=' . $this->_iterationCount . '$';
        }

        $salt = $this->_encode64($input, 12);

        return '$' . $identifier . '$' . $rounds . $salt . '$';
    }
1047251
function format(input, level, options) {
  if (util.isArray(input)) {
    return array(input, level, options);
  } else if (util.isObject(input)) {
    return object(input, level, options);
  } else {
    return stringify(input, options);
  }
}
149473
public static function format($value)
    {
        $value = Utils::toString($value);
        $value = mb_strtolower($value);

        if (Utils::isZeroPrefixed($value)) {
            return $value;
        } else {
            $value = Utils::toHex($value, true);
        }
        return $value;
    }
368360
public static function formatAmount(int $amount): string
    {
        if (static::$formatCurrencyUsing) {
            return call_user_func(static::$formatCurrencyUsing, $amount);
        }
        $amount = number_format($amount / 100, 2);
        if (StringHelper::startsWith($amount, '-')) {
            return '-' . static::usesCurrencySymbol() . ltrim($amount, '-');
        }

        return static::usesCurrencySymbol() . $amount;
    }
618336
public function decode($input)
    {
        // Don't use UCS-2.
        $output = [];
        $inputLength = strlen($input);
        $i = 0;
        $n = self::INITIAL_N;
        $bias = self::INITIAL_BIAS;

        // Handle the basic code points: let `basic` be the number of input code
        // points before the last delimiter, or `0` if there is none, then copy
        // the first basic code points to the output.

        $basic = strrpos($input, self::DELIMITER);
        if ($basic === false ) {
            $basic = 0;
        }

        for ($j = 0; $j < $basic; ++$j) {
            // if it's not a basic code point
            if ( ord($input[$j]) >= 0x80) {
                $this->error('not-basic');
            }
            $output[] = ord($input[$j]);
        }

        // Main decoding loop: start just after the last delimiter if any basic code
        // points were copied; start at the beginning otherwise.

        for ( $index = $basic > 0 ? $basic + 1 : 0; $index < $inputLength; /* no final expression */) {

            // `index` is the index of the next character to be consumed.
            // Decode a generalized variable-$length integer into `delta`,
            // which gets added to `i`. The overflow checking is easier
            // if we increase `i` as we go, then subtract off its starting
            // value at the end to obtain `delta`.
            $oldi = $i;
            for ( $w = 1, $k = self::BASE; /* no condition */; $k += self::BASE) {

                if ($index >= $inputLength) {
                    $this->error('invalid-input');
                }

                $digit = $this->basicToDigit(ord($input[$index++]));

                if ($digit >= self::BASE || $digit > floor((self::MAX_INT - $i) / $w)) {
                    $this->error('overflow');
                }

                $i += $digit * $w;
                $t = $k <= $bias ? self::T_MIN : ($k >= $bias + self::T_MAX ? self::T_MAX : $k - $bias);

                if ($digit < $t) {
                    break;
                }

                $baseMinusT = self::BASE - $t;
                if ($w > floor(self::MAX_INT / $baseMinusT)) {
                    $this->error('overflow');
                }

                $w *= $baseMinusT;

            }

            $out = count($output) + 1;
            $bias = $this->adapt($i - $oldi, $out, $oldi == 0);

            // `i` was supposed to wrap around from `out` to `0`,
            // incrementing `n` each time, so we'll fix that now:
            if (floor($i / $out) > self::MAX_INT - $n) {
                $this->error('overflow');
            }

            $n += floor($i / $out);
            $i %= $out;

            // Insert `n` at position `i` of the output.
            array_splice($output, $i++, 0, $n);
        }

        return mb_convert_encoding($this->ucs2Encode($output), "UTF-8", "UTF-16");
    }