String MUST already be escaped
@param string $string
@return integer id referencing string
187092
public function writeString($string)
    {
        fwrite($this->stream, '    <si><t>' . Utils::escape($string) . '</t></si>' . MyWriter::EOL);
        return $this->id++;
    }
1274408
private function getEncoding(string &$string): string
    {
        # Check for the UTF-8 byte order mark
        if (substr($string, 0, 3) === self::UTF8) {
            $string = substr($string, 3);
            return self::UTF8;
        }

        # Check for the UTF-16 big endian byte order mark
        if (substr($string, 0, 2) === self::UTF16BE) {
            $string = substr($string, 2);
            return self::UTF16BE;
        }

        # Check for the UTF-16 little endian byte order mark
        if (substr($string, 0, 2) === self::UTF16LE) {
            $string = substr($string, 2);
            return self::UTF16LE;
        }

        return self::UNKNOWN;
    }
293302
public function sanitizeString($string)
    {
        $string = str_replace('_', '-', GeneralUtility::camelCaseToLowerCaseUnderscored($string));

        while (strpos($string, '--')) {
            $string = str_replace('--', '-', $string);
        }

        return $string;
    }
416634
public static function url($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);
		}

        return rawurlencode($string);
    }
941930
private function _str2hex($string)
    {
        $hex = bin2hex($string);
        $xhex = "";

        for ($i = 0; $i < strlen($hex) - 1; $i += 2) {
            $xhex .= '\x' . $hex[$i] . $hex[$i + 1];
        }

        return $xhex;
    }
655656
public function literal($string) {
        $string = trim($string, $this->_escapeCharOpen . $this->_escapeCharClose . $this->_quoteChar);
        return $string;
    }
808197
private function prepareString($string)
    {
        return str_replace(
            array_keys($this->owner->variables),
            array_values($this->owner->variables),
            $string
        );
    }
1255659
public function escapeString($string)
    {
        if (func_num_args() < 2) {
            if (strpos($string, "\n") !== false) {
                return array('{' . strlen($string) . '}', $string);
            } else {
                return '"' . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string) . '"';
            }
        }
        $result = array();
        foreach (func_get_args() as $string) {
            $result[] = $this->escapeString($string);
        }
        return $result;
    }
902533
public function escapeParam($string)
    {
        foreach ([ "\r\n", "\r", "\n" ] as $badBytes) {
            if (false !== strpos($string, $badBytes)) {
                $string = str_replace($badBytes, " ", $string);
            }
        }

        if (false !== strpos($string, "\0")) {
            $string = str_replace("\0", "", $string);
        }

        return $string;
    }
1303744
public function escape($string)
    {
        $string = mb_convert_encoding($string, 'UTF-8', 'UTF-8');
        $string = str_replace('{{', '', $string);
        $string = str_replace('}}', '', $string);

        return htmlentities($string, ENT_QUOTES, 'UTF-8');
    }
919175
public static function stringToKey(string $string): int {
        $key = 0;
        for ($i = 0; $i < \strlen($string); $i++) {
            $char = $string[$i];
            $key += \ord($char);
        }
        return $key;
    }
48971
public static function escape($string, $context = 'html')
    {
        $method = 'escape'.ucfirst($context);

        if(!method_exists(__CLASS__, $method)) {
            throw new \InvalidArgumentException(sprintf('Cannot escape to: %s. Unknow context.', $context));
        }

        return static::$method($string);
    }
360471
private function _escape($string, $escapeChar)
    {
        if ($escapeChar) {
            $this->buffer = $escapeChar;

            return preg_replace_callback(
                '/\\' . $escapeChar . '(.)' .'/',
                array(&$this, '_escapeBis'),
                $string
            );

        } else {
            return $string;
        }
    }
1351793
private static String escape(String string) {
    return StringUtils.escapeString(string, StringUtils.ESCAPE_CHAR, 
                                    charsToEscape);
  }
43270
protected static function _validateIdOrTag($string)
    {
        if (!is_string($string)) {
            Zend_Cache::throwException('Invalid id or tag : must be a string');
        }
        if (substr($string, 0, 9) == 'internal-') {
            Zend_Cache::throwException('"internal-*" ids or tags are reserved');
        }
        if (!preg_match('~^[a-zA-Z0-9_]+$~D', $string)) {
            Zend_Cache::throwException("Invalid id or tag '$string' : must use only [a-zA-Z0-9_]");
        }
    }
262617
protected static function strLen($string){
    $encoding = function_exists('mb_detect_encoding') ? mb_detect_encoding($string) : false;
    return $encoding ? mb_strlen($string, $encoding) : strlen($string);
  }
1254539
public function expandString($string)
    {
        $retval = "";
        //$string = htmlspecialchars($string);
        $size = strlen($string);
        $retval = $size.$string;

        return $retval;
    }