@param $string

@return int
961130
public static function string2timestamp($string)
    {
        $matches = array();
        if (!preg_match(
                '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d+)?Z$/D',
                $string,
                $matches
            )
        ) {
            throw new \InvalidArgumentException('Invalid timestamp: '.$string);
        }

        $year = intval($matches[1]);
        $month = intval($matches[2]);
        $day = intval($matches[3]);
        $hour = intval($matches[4]);
        $minute = intval($matches[5]);
        $second = intval($matches[6]);
        // Use gmmktime because the timestamp will always be given in UTC?
        $ts = gmmktime($hour, $minute, $second, $month, $day, $year);

        return $ts;
    }
1161430
public function write($string)
    {
        $this->content = Text::insert($this->content, $this->position, $string);
        $len = strlen($string);
        $this->position += $len;
        return $len;
    }
702515
public static function attr($string) {

        if(null === $string) {
            return '';
        }

    	if(true === is_numeric($string)) {
    		return $string;
    	}

    	if(false === is_string($string)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($string)), E_USER_ERROR);
		}

        $string = static :: toUtf8($string);

        if(0 === strlen($string) || ctype_digit($string)) {
            return $string;
        }

        $result = preg_replace_callback('/[^a-z0-9,\.\-_]/iSu', [__CLASS__, 'htmlAttrMatcher'], $string);

        return static :: fromUtf8($result);
    }
631899
protected function _parseAttributes($string)
    {
        $result = array();

        if (!empty($string)) {
            $attr   = array();

            preg_match_all('/([\w:-]+)[\s]?=[\s]?"([^"]*)"/i', $string, $attr);

            if (is_array($attr)) {
                $numPairs = count($attr[1]);
                for ($i = 0; $i < $numPairs; $i++) {
                    $result[$attr[1][$i]] = $attr[2][$i];
                }
            }
        }

        return $result;
    }
493016
public static function getIdListFromString($string)
    {
        if (filter_var($string, FILTER_VALIDATE_INT) !== false) {
            return array($string);
        }

        return array_map(
            function ($id) {
                if (false === filter_var($id, FILTER_VALIDATE_INT)) {
                    throw new InvalidArgumentException('String should be a list of Integers');
                }

                return (int) $id;
            },
            explode(',', $string)
        );
    }
1191226
private Number parseNumber(String string) {
		if (string.length() > 2 && string.charAt(0) == '0' && string.charAt(1) == 'x') {
			return Long.parseLong(string.substring(2), 16);
		}
		return Double.parseDouble(string);
	}
1121268
public function parseString($string)
    {
        $value = $this->getParser()->parse($string);

        if ($this->trimArrayValues && is_array($value)) {
            return $this->trimArray($value);
        }

        return $value;
    }
334968
public function translate($string)
    {
        $args = func_get_args();
        $translated = array_shift($args);
        $extraParams = $args;
        if (count($extraParams)>0)
        {
            $translated = vsprintf($translated, $extraParams);
        }

        return $translated;
    }
743836
public function getTidy($string)
    {
        if (class_exists('Tidy')) {
            if (!$this->_tidy) {
                $this->_tidy = new Tidy();
            }

            $this->_tidy->parseString($string, $this->_config, $this->_encoding);
        }

        return $this->_tidy;
    }
1135251
public static function ord(string $char): int
    {
        $char = mb_convert_encoding($char, 'UTF-32BE', 'UTF-8');

        return (int) unpack('Ncode', $char)['code'];
    }
245248
public static function stringToBytes(string $string): int
    {
        $original = trim($string);
        $number = (int)$original;

        if ($number === $original || $number === 0) {
            return $number;
        } else {
            $char = strtoupper(substr($original, -1, 1));
            switch ($char) {
                case 'K': // KILO
                    return $number * 1024;
                    break;

                case 'M': // MEGA
                    return $number * pow(1024, 2);
                    break;

                case 'G': // GIGA
                    return $number * pow(1024, 3);
                    break;

                case 'T': // TERA
                    return $number * pow(1024, 4);
                    break;

                case 'P': // PETA
                    return $number * pow(1024, 5);
                    break;

                case 'E': // EXA
                    return $number * pow(1024, 6);
                    break;

                default:
                    throw new ConvertException('Not implemented sizes greater than exabytes');
                    break;
            }
        }
    }
162895
public function parseString($string)
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        foreach ($this->data as $key => $value) {
            $string = str_replace($key, $value, $string);
        }

        return $string;
    }
93983
public static function parseAttributes($string)
	{
		// Initialise variables.
		$attr = array();
		$ret  = array();

		// Let's grab all the key/value pairs using a regular expression
		preg_match_all('/([\w:-]+)[\s]?=[\s]?"([^"]*)"/i', $string, $attr);

		if (is_array($attr))
		{
			$numPairs = count($attr[1]);
			for ($i = 0; $i < $numPairs; $i++)
			{
				$ret[$attr[1][$i]] = $attr[2][$i];
			}
		}

		return $ret;
	}
336731
public function loadString($string)
    {
        $this->string = htmlspecialchars_decode($string);

        return (bool)empty($this->string);
    }
517298
public static function lcFirst($string)
    {
        $lcFirst = static::sub($string, 0, 1);
        $lcFirst = static::low($lcFirst);

        return $lcFirst . static::sub($string, 1);
    }
1339199
public function parseString($string)
    {
        $string = (string) $string;
        $string = preg_replace_callback("/\\$\{(.*?)\}/",
            function ($k) {
                return $this->get($k[1]);
            }, $string);

        return $string;
    }
751030
protected function sendString($string)
    {
        if ($this->pop_conn) {
            if ($this->do_debug >= 2) { //Show client messages when debug >= 2
                echo 'Client -> Server: ', $string;
            }

            return fwrite($this->pop_conn, $string, strlen($string));
        }

        return 0;
    }