Get the Unicode of the character at the specified index in a string.

@param string $str
@param int    $index

@return null|number
327836
private function charCodeAt($str, $index)
    {
        $char = mb_substr($str, $index, 1, 'UTF-8');
        if (mb_check_encoding($char, 'UTF-8')) {
            $ret = mb_convert_encoding($char, 'UTF-32BE', 'UTF-8');
            $result = hexdec(bin2hex($ret));

            return $result;
        }

        return;
    }
1250142
public String stringAt(String srcStr, int index) {

        if (0 <= index && index < srcStr.length()) {
            return String.valueOf(srcStr.charAt(index));
        } else {
            return "";
        }

    }
688176
public function get(?string $index, string $text, ?array $params = null)
    {
        if (App::$Request->getLanguage() !== App::$Properties->get('baseLanguage')) {
            if ($index && !Arr::in($index, $this->indexes)) {
                $this->cached = Arr::merge($this->cached, $this->load($index));
                $this->indexes[] = $index;
            }

            if ($this->cached && Any::isStr($text) && isset($this->cached[$text])) {
                $text = $this->cached[$text];
            }
        }

        if (Any::isArray($params) && count($params) > 0) {
            foreach ($params as $var => $value) {
                $text = Str::replace('%' . $var . '%', $value, $text);
            }
        }
        return $text;
    }
1277497
protected function nextChar(string $str, int &$p): ?string
    {
        $p += strspn($str, " \t\r\n", $p);
        return isset($str[$p]) ? $str[$p] : null;
    }
1279817
public static function getString(&$str)
    {
        $p = strpos($str, "\x00");
        if ($p === false) {
            return '';
        }
        $r   = static::binarySubstr($str, 0, $p);
        $str = static::binarySubstr($str, $p + 1);

        return $r;
    }
1040399
public function getTextResourceHandle($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET)
    {
        $textPart = $this->getTextPart($index);
        if ($textPart !== null) {
            return $textPart->getContentResourceHandle($charset);
        }
        return null;
    }
1304453
public function getSearchIndex($index)
    {
        return isset($this->search[$index]) ? $this->search[$index] : null;
    }
722710
public static function ensureUTF8($str) {
		if($str == NULL) {
			return NULL;
		}
		$enc = mb_detect_encoding($str, array('ISO-8859-1', 'ISO-8859-15', 'UTF-8', 'ASCII'));
		if($enc !== FALSE) {
			if($enc == 'ISO-8859-1' || $enc == 'ISO-8859-15') {
				$str = mb_convert_encoding($str, 'UTF-8', $enc);
			}
		}
		return $str;
	}
1139605
function UTF8toSubset($str)
	{
		$ret = '<';
		// $str = preg_replace('/'.preg_quote($this->aliasNbPg,'/').'/', chr(7), $str );	// mPDF 6 deleted
		// $str = preg_replace('/'.preg_quote($this->aliasNbPgGp,'/').'/', chr(8), $str );	// mPDF 6 deleted
		$unicode = $this->UTF8StringToArray($str);
		$orig_fid = $this->CurrentFont['subsetfontids'][0];
		$last_fid = $this->CurrentFont['subsetfontids'][0];
		foreach ($unicode as $c) {
			/* 	// mPDF 6 deleted
			  if ($c == 7 || $c == 8) {
			  if ($orig_fid != $last_fid) {
			  $ret .= '> Tj /F'.$orig_fid.' '.$this->FontSizePt.' Tf <';
			  $last_fid = $orig_fid;
			  }
			  if ($c == 7) { $ret .= $this->aliasNbPgHex; }
			  else { $ret .= $this->aliasNbPgGpHex; }
			  continue;
			  }
			 */
			if (!$this->_charDefined($this->CurrentFont['cw'], $c)) {
				$c = 0;
			} // mPDF 6
			for ($i = 0; $i < 99; $i++) {
				// return c as decimal char
				$init = array_search($c, $this->CurrentFont['subsets'][$i]);
				if ($init !== false) {
					if ($this->CurrentFont['subsetfontids'][$i] != $last_fid) {
						$ret .= '> Tj /F' . $this->CurrentFont['subsetfontids'][$i] . ' ' . $this->FontSizePt . ' Tf <';
						$last_fid = $this->CurrentFont['subsetfontids'][$i];
					}
					$ret .= sprintf("%02s", strtoupper(dechex($init)));
					break;
				} // TrueType embedded SUBSETS
				elseif (count($this->CurrentFont['subsets'][$i]) < 255) {
					$n = count($this->CurrentFont['subsets'][$i]);
					$this->CurrentFont['subsets'][$i][$n] = $c;
					if ($this->CurrentFont['subsetfontids'][$i] != $last_fid) {
						$ret .= '> Tj /F' . $this->CurrentFont['subsetfontids'][$i] . ' ' . $this->FontSizePt . ' Tf <';
						$last_fid = $this->CurrentFont['subsetfontids'][$i];
					}
					$ret .= sprintf("%02s", strtoupper(dechex($n)));
					break;
				} elseif (!isset($this->CurrentFont['subsets'][($i + 1)])) {
					// TrueType embedded SUBSETS
					$this->CurrentFont['subsets'][($i + 1)] = [0 => 0];
					$new_fid = count($this->fonts) + $this->extraFontSubsets + 1;
					$this->CurrentFont['subsetfontids'][($i + 1)] = $new_fid;
					$this->extraFontSubsets++;
				}
			}
		}
		$ret .= '>';
		if ($last_fid != $orig_fid) {
			$ret .= ' Tj /F' . $orig_fid . ' ' . $this->FontSizePt . ' Tf <> ';
		}
		return $ret;
	}
828492
public static function getString(&$str)
    {
        $p = mb_orig_strpos($str, "\x00");
        if ($p === false) {
            return '';
        }
        $r = mb_orig_substr($str, 0, $p);
        $str = mb_orig_substr($str, $p + 1);
        return $r;
    }
1293125
public function getTextStream($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET)
    {
        $textPart = $this->getTextPart($index);
        if ($textPart !== null) {
            return $textPart->getContentStream($charset);
        }
        return null;
    }
407675
public function getName($index = null)
    {
        $type = $this->getType($index);
        return is_int($type) ? token_name($type) : null;
    }
882726
private function ordUtf8($text, $index = 0, $bytes = null)
    {
        $len = strlen($text);
        $bytes = 0;

        $char = false;

        if ($index < $len)
        {
            $h = ord($text{$index});

            if($h <= 0x7F)
            {
                $bytes = 1;
                $char = $h;
            }
            elseif ($h < 0xC2)
            {
                $char = false;
            }
            elseif ($h <= 0xDF && $index < $len - 1)
            {
                $bytes = 2;
                $char = ($h & 0x1F) <<  6 | (ord($text{$index + 1}) & 0x3F);
            }
            elseif($h <= 0xEF && $index < $len - 2)
            {
                $bytes = 3;
                $char = ($h & 0x0F) << 12 | (ord($text{$index + 1}) & 0x3F) << 6
                                         | (ord($text{$index + 2}) & 0x3F);
            }
            elseif($h <= 0xF4 && $index < $len - 3)
            {
                $bytes = 4;
                $char = ($h & 0x0F) << 18 | (ord($text{$index + 1}) & 0x3F) << 12
                                         | (ord($text{$index + 2}) & 0x3F) << 6
                                         | (ord($text{$index + 3}) & 0x3F);
            }
        }


        return array($char, $bytes);
    }
483544
public function getNameByIndex($index)
    {
        return isset($this->names[$index]) ? $this->names[$index] : null;
    }
618061
public static function get_value_between_chars($haystack, $index = 0, $opening_char = '[', $closing_char = ']')
	{
	    $offset = 0;
	    $found = true;
	    $value = null;
	 
	    for ($i = 0; $i < $index + 1; $i++)
	    {
	        $op_pos = strpos($haystack, $opening_char, $offset);
	        if($op_pos !== false)
	        {
	            $cl_pos = strpos($haystack, $closing_char, $op_pos + strlen($opening_char));
	 
	            if($cl_pos !== false)
	            {
	                $value = substr($haystack, $op_pos + strlen($opening_char), $cl_pos - $op_pos - strlen($opening_char));
	                $offset = $cl_pos + strlen($closing_char);
	            }
	            else
	            {
	                $found = false;
	                break;
	            }
	        }
	        else
	        {
	            $found = false;
	            break;
	        }
	    }
	 
	    if($found)
	    {
	        return $value;
	    }
	    else
	    {
	        return null;
	    }
	}
104662
synchronized char getChar(long index) {
        int i = loadBufferIfNeeded(index);
        int ch1 = ((int) dumpBuffer[i++]) & 0xFF;
        int ch2 = ((int) dumpBuffer[i]) & 0xFF;

        return (char) ((ch1 << 8) + (ch2 << 0));
    }
1359683
public function getHtmlContent($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET)
    {
        $part = $this->getHtmlPart($index);
        if ($part !== null) {
            return $part->getContent($charset);
        }
        return null;
    }