Returns the formatted tax.

@param int    $decimals
@param string $decimalPoint
@param string $thousandSeperator
@return string
554512
public function tax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
    {
        return $this->numberFormat($this->tax, $decimals, $decimalPoint, $thousandSeperator);
    }
573817
private function getDecimalPart($decimalPart)
    {
        $result = '';
        if ($decimalPart > 0) {
            $unit = strlen($decimalPart) - 1;
            for ($i = 0; $i < strlen($decimalPart); ++$i) {
                $num = $decimalPart[$i];
                $result .= $this->uppers[$num].$this->units[$unit--];
            }
        }
        $result = str_replace('零分', '', $result);
        if ($this->thanOne) {
            $result = str_replace('零角', '零', $result);
        } else {
            $result = str_replace('零角', '', $result);
        }

        return $result;
    }
603423
public function value(float $value, int $decimal_points = null): string
    {
        if (is_null($decimal_points)) {
            return $value;
        }

        return $this->decimal($value, $decimal_points);
    }
590760
public function getStringByByte($bytes, $decimals = 2, $decimalPoint = '.', $thousandsSeparator = ',')
    {
        $size = [
            'B',
            'kB',
            'MB',
            'GB',
            'TB',
            'PB',
            'EB',
            'ZB',
            'YB',
        ];

        $factor = intval(floor((strlen($bytes) - 1) / 3));
        if (false === isset($size[$factor])) {
            return $bytes;
        }

        return sprintf('%s %s', number_format($bytes / pow(1024, $factor), $decimals, $decimalPoint, $thousandsSeparator), $size[$factor]);
    }
155930
public static function format($number, $decimals = 2, $decimalPoint = '.', $thousandSeparator = ',')
    {
        return number_format($number, $decimals, $decimalPoint, $thousandSeparator);
    }
684096
public function formatMoney(Money $money, $decPoint = ',', $thousandsSep = ' ')
    {
        $symbol = $this->formatCurrency($money);
        $amount = $this->formatAmount($money, $decPoint, $thousandsSep);
        $price = $amount." ".$symbol;

        return $price;
    }
603137
public function getCountryCode4Ip(int $decimalIp): string
    {
        $query = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.ipMin <= :ip')
            ->andWhere('p.ipMax >= :ip')
            ->setParameter('ip', $decimalIp)
            ->getQuery();

        /** @var \PServerCore\Entity\CountryList $result */
        $result = $query->getOneOrNullResult();
        if (!$result) {
            return 'ZZZ';
        }
        return $result->getCntry();
    }
979379
public static function format($value, int $decimals = 2): ?string {
        if (!\is_numeric($value)) {
            return null;
        }
        return \number_format($value, $decimals);
    }
497480
protected function getNumberFormatter()
    {
        $formatter = parent::getNumberFormatter();

        $formatter->setSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, $this->thousandsSeparator);
        $formatter->setSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, $this->decimalSeparator);
        $formatter->setPattern(sprintf('#%s##0%s###', $this->thousandsSeparator, $this->decimalSeparator));

        return $formatter;
    }
98162
protected function toMany(array $units, $decimals = null, $round = true)
    {
        $results = array();
        foreach ($units as $key) {
            $results[$key] = $this->to($key, $decimals, $round);
        }

        return $results;
    }
925490
public function convertToFloat(Stringy $string, $decimalPoints = self::DECIMAL_POINTS)
    {
        if (!is_int($decimalPoints)) {
            $decimalPoints = self::DECIMAL_POINTS;
        }
        return (float) preg_replace('#(\d*)(\d{' . $decimalPoints . '})$#', '$1.$2', $string->__toString());
    }
662715
public static function nReal($number, $decimals = 2, $symbol = true, $fixed = true)
    {
        if (is_null($number) || empty(self::onlyNumbers($number))) {
            return '';
        }
        $formater = new \NumberFormatter("pt-BR", \NumberFormatter::CURRENCY);
        $formater->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, ($fixed ? $decimals : 1));
        if ($decimals === false) {
            $decimals = 2;
            preg_match_all('/[0-9][^0-9]([0-9]+)/', $number, $matches);
            if (!empty($matches[1])) {
                $decimals = mb_strlen(rtrim($matches[1][0], 0));
            }
        }
        $formater->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $decimals);
        if (!$symbol) {
            $pattern = preg_replace("/[¤]/", '', $formater->getPattern());
            $formater->setPattern($pattern);
        } else {
            // ESPAÇO DEPOIS DO SIMBOLO
            $pattern = str_replace("¤", "¤ ", $formater->getPattern());
            $formater->setPattern($pattern);
        }
        return $formater->formatCurrency($number, $formater->getTextAttribute(\NumberFormatter::CURRENCY_CODE));
    }
1078746
public function format($decimals = 2, $decPoint = '.', $thousandSep = ',')
    {
        return number_format($this->value, $decimals, $decPoint, $thousandSep);
    }
1145744
public static function formatSize($size, $unit = null, $decimals = 2) {


        // Initialize the units.
        $units = static::getUnits();

        // Find the unit.
        $index = array_search($unit, $units);
        if (null !== $unit && false === $index) {
            throw new IllegalArgumentException("The unit \"" . $unit . "\" does not exists");
        }

        // Initialize the output.
        $output = $size;

        $iteration = 0;
        while (self::FILE_SIZE_DIVIDER <= $output || $iteration < $index) {
            $output /= self::FILE_SIZE_DIVIDER;
            ++$iteration;
        }

        // Return the output.
        return implode(" ", [sprintf("%." . $decimals . "f", $output), $units[$iteration]]);
    }
834030
public static function quantity(int $num, int $decimals = 0) : string
    {
        if ($num >= 1000 && $num < 1000000) {
            return sprintf('%01.'.$decimals.'f', (sprintf('%01.0f', $num) / 1000)).'K';
        } elseif ($num >= 1000000 && $num < 1000000000) {
            return sprintf('%01.'.$decimals.'f', (sprintf('%01.0f', $num) / 1000000)).'M';
        } elseif ($num >= 1000000000) {
            return sprintf('%01.'.$decimals.'f', (sprintf('%01.0f', $num) / 1000000000)).'B';
        }

        return $num;
    }
398488
protected function getCurrencyFormat(ExcelBook $book, $currency, $decimals)
    {
        $id = "$currency/$decimals";
        if (!$this->currency_formats->offsetExists($id)) {
            if (array_key_exists($currency, $this->currencyMap)) {
                $symbol = $this->currencyMap[$currency];
            } else {
                $symbol = $currency;
            }

            $formatString = '#,##0';

            if ($decimals > 0) {
                $zeros = str_repeat('0', $decimals);
                $formatString = $formatString . '.' . $zeros;
            }
            $formatString = $formatString . ' "' . $symbol . '"_-';

            //$formatString = $formatString . ' [$€-80C]_-';
            //$format_code = '"C$"' . $format_code . '_-';

            $cfid = $book->addCustomFormat($formatString);
            $format = $book->addFormat();
            $format->numberFormat($cfid);
            $this->currency_formats->offsetSet($id, $format);
        }

        return $this->currency_formats->offsetGet($id);
    }
48932
protected function renderFloat($number, $decimals = 2, $decPoint = ".", $thousandsSep = ",") {
        if (null === $number) {
            return "";
        }
        return number_format($number, $decimals, $decPoint, $thousandsSep);
    }