Returns '1st', '2nd', '3rd', '4th' string part for given number

@param $nr

@return string
773102
protected function translateTh($nr)
    {
        // fr: 1ère, 2ème, 3ème, 4ème
        // de: 1., 2., 3., 4.
        $key = $this->lang;
        if (!isset($this->uiTh[$key])) {
            $key = key($this->uiTh);
        }
        if (isset($this->uiTh[$key][$nr])) {
            return $this->uiTh[$key][$nr];
        } else {
            return $this->uiTh[$key][4];
        }
    }
1280595
public String shortOrdinal(long n) {
        String str = Long.toString(n);

        if (n < 0) {
            n = -n;
        }

        n %= 100;

        if (n >= 10 && n <= 20) {
            str = str.concat("th");
        }
        else {
            if (n > 20) n %= 10;

            switch ((int) n) {
            case 1:
                str = str.concat("st"); break;
            case 2:
                str = str.concat("nd"); break;
            case 3:
                str = str.concat("rd"); break;
            default:
                str = str.concat("th"); break;
            }
        }

        return str;
    }
596926
public static function secondToWords(int $second){
        $day = $minute = $hour = $sec = 0;
        $str = '';
        $sec = $second % 60;
        $minute = intval($second / 60) % 60;
        $hour = intval($second / (60 * 60)) % 24;
        $day = intval($hour / 24);
        if($hour){
            $str .= ($hour . '时');
        }
        if(strlen($minute) == 1){
            $minute = '0' . $minute;
        }
        if(strlen($sec) == 1){
            $sec = '0' . $sec;
        }
        $str .=  ($minute . '分' . $sec . '秒');
        return [
            'str' => $str,
            'day' => $day,
            'hour' => $hour,
            'minute' => $minute,
            'sec' => $sec
        ];
    }
968530
public function txts($string, $n)
	{
		$args  = func_get_args();
		$count = count($args);

		if ($count > 1)
		{
			// Try the key from the language plural potential suffixes
			$found = false;
			$suffixes = $this->getPluralSuffixes((int) $n);
			array_unshift($suffixes, (int) $n);
			foreach ($suffixes as $suffix)
			{
				$key = $string . '_' . $suffix;
				if ($this->hasKey($key))
				{
					$found = true;
					break;
				}
			}
			if (!$found)
			{
				// Not found so revert to the original.
				$key = $string;
			}
			if (is_array($args[$count - 1]))
			{
				$args[0] = $this->translate(
					$key, array_key_exists('jsSafe', $args[$count - 1]) ? $args[$count - 1]['jsSafe'] : false,
					array_key_exists('interpretBackSlashes', $args[$count - 1]) ? $args[$count - 1]['interpretBackSlashes'] : true
				);
			}
			else
			{
				$args[0] = $this->translate($key);
			}
			return call_user_func_array('sprintf', $args);
		}
		elseif ($count > 0)
		{

			// Default to the normal sprintf handling.
			$args[0] = $this->translate($string);
			return call_user_func_array('sprintf', $args);
		}

		return '';
	}
515525
private function number_format($number, $decimal_precision = 0, $decimals_separator = '.', $thousands_separator = ',') {
        $number = explode('.', str_replace(' ', '', $number));
        $number[0] = str_split(strrev($number[0]), 3);
        $total_segments = count($number[0]);
        for ($i = 0; $i < $total_segments; $i++) {
            $number[0][$i] = strrev($number[0][$i]);
        }
        $number[0] = implode($thousands_separator, array_reverse($number[0]));
        if (!empty($number[1])) {
           $number[1] = round($number[1], $decimal_precision);
        }
        return implode($decimals_separator, $number);
    }
883864
public static function ordinalize($number)
    {
        if (in_array(($number % 100), range(11, 13))) {
            return $number . 'th';
        }
        switch ($number % 10) {
            case 1:
                return $number . 'st';
            case 2:
                return $number . 'nd';
            case 3:
                return $number . 'rd';
            default:
                return $number . 'th';
        }
    }
1079028
public function getNumbers()
    {
        return (string) \OxidEsales\Eshop\Core\Str::getStr()->substr($this->_cleanUp($this->_sCompanyVatNumber), 2);
    }
867099
static public function v4(): string {
        $n = array();
        for ($i = 0; $i < 8; $i++) {
            $n[$i] = mt_rand(0, 0xffff);
        }
        $n[3] = $n[3] | 0x4000;
        $n[4] = $n[4] | 0x8000;
        $format = '%04x%04x-%04x-%04x-%04x-%04x%04x%04x';
        return sprintf($format, $n[0], $n[1], $n[2], $n[3], $n[4], $n[5], $n[6], $n[7]);
    }
655809
public function toString(): string
    {
        $parts = array_map(
            function (RDN $rdn) {
                return $rdn->toString();
            }, array_reverse($this->_rdns));
        return implode(",", $parts);
    }
1203290
public function read($n)
    {
        if (0 === $n) {
            return '';
        }

        $remaining = ($n - $this->length) + $this->position;

        while ($remaining > 0) {
            //$this->io->wait();
            if ($this->io->shouldEnableCrypto()) {
                $new = $this->io->read($remaining);
            } else {
                $new = $this->io->readChunk($remaining);
            }
            $this->bytes .= $new;
            $remaining -= strlen($new);
        }

        $this->length = strlen($this->bytes);
        $data = substr($this->bytes, $this->position, $n);
        $this->position += $n;

        return $data;
    }
696594
public static function num2alpha($n)
    {
        $n = $n - 1;
        $r = '';
        for ($i = 1; $n >= 0 && $i < 10; $i++) {
            $r = chr(0x41 + ($n % pow(26, $i) / pow(26, $i - 1))) . $r;
            $n -= pow(26, $i);
        }
        return $r;
    }
90230
def positional_number_string(n):
    
    if n > 20:
        suffix = positional_suffix[n % 10]
        return "%d%s" % (n, suffix)
    elif n > 3:
        return "%dth" % n
    elif n == 3:
        return "third"
    elif n == 2:
        return "second"
    elif n == 1:
        return "first"
    return "zeroeth"
602964
public function getNFirst($n)
    {
        $it = new \ArrayIterator();
        $j = 0;
        foreach ($this as $file) {
            if ($j == $n) {
                break;
            }
            $j++;
            $it->append($file);
        }

        $finder = new static();
        $finder->append($it);

        return $finder;
    }
13415
public function getSigFigs($n)
    {
        $n = ltrim($n, '0+-');
        $dp = strpos($n, '.'); // decimal position
        if ($dp === false) {
            $sigfigs = strlen(rtrim($n, '0'));
        } else {
            $sigfigs = strlen(ltrim($n, '0.')); // eliminate extra decimal character
            if ($dp !== 0) {
                $sigfigs--;
            }
        }
        return $sigfigs;
    }
754492
public function nth( $nth ) {

		if ( empty( $nth ) ) {
			$nth = 2;
		}

		$offset   = 0;
		$negative = false;

		if ( 'even' === $nth ) {
			$nth = 2;
		} elseif ( 'odd' === $nth ) {
			$negative = true;
			$nth      = 2;
		} elseif ( false !== strpos( $nth, '+' ) ) {
			$nth = explode( '+', $nth );

			if ( isset( $nth[1] ) ) {
				$offset += (int) trim( $nth[1] );
			}

			$nth = (int) trim( $nth[0], ' n' );
		} elseif ( false !== strpos( $nth, '-' ) ) {
			$nth = explode( '-', $nth );

			if ( isset( $nth[1] ) ) {
				$offset -= (int) trim( $nth[1] );
			}

			$nth = (int) trim( $nth[0], ' n' );
		}//end if

		$nth    = (int) $nth;
		$offset = (int) $offset;

		if ( 0 === ( ( $this->row_number % $nth ) + $offset ) ) {
			return ( $negative ? false : true );
		}

		return ( $negative ? true : false );
	}
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);
    }
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));
    }