@param string $s

@return string
350679
public static function charsToNormalTitle(string $s): string
    {
        if (is_array($s)) {
            $res = [];

            foreach ($s as $k => $v) {
                $res[$k] = strtr(ucfirst(strtolower($v)), ['_' => ' ']);
            }

            $s = $res;
        } elseif (is_string($s)) {
            $s = strtr(ucfirst(strtolower($s)), ['_' => ' ']);
        }

        return $s;
    }
1027899
protected function _params2string($params)
    {
        if (!count($params)) {
            return '';
        }
        $paramsPart = array();
        foreach ($params as $name => $value) {
            if (!$value && ('0' !== $value)) {
                continue;
            }
            $paramsPart[] = str_replace(array('{name}', '{value}'), array($name, urlencode($value)), $this->paramsPairStructure);
        }
        if (!count($paramsPart)) {
            return '';
        }
        return '/' . implode($this->paramsSeparator, $paramsPart);
    }
681393
public static function strict($s)
	{
		if (! ReflectionTypeHint::isValid()) return false;
		if (is_null($s)) return $s;
		return preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]+/sSX', '', $s);
	}
665687
public static function base64UrlSafeDecode($s)
    {
        $s = str_replace('_', '/', $s);
        $s = str_replace('-', '+', $s);
        $s = base64_decode($s);
        return ($s);
    }
231525
public static function camelToUnderdash($s)
	{
		$s = preg_replace('#(.)(?=[A-Z])#', '$1_', $s);
		$s = strtolower($s);
		$s = rawurlencode($s);

		return $s;
	}
1226753
static function noAccents($s)
	{
		$s = str_replace(array('É', 'È', 'Ë', 'Ê'), 'E', $s);
		$s = str_replace(array('À', 'Ä', 'Â'), 'A', $s);
		$s = str_replace(array('Ï', 'Î'), 'I', $s);
		$s = str_replace(array('Ö', 'Ô'), 'O', $s);
		$s = str_replace(array('Ù', 'Ü' ,'Û'), 'U', $s);
		$s = str_replace('Ç', 'C', $s);
	
		$s = str_replace(array('é', 'è', 'ë', 'ê'), 'e', $s);
		$s = str_replace(array('à', 'ä', 'â'), 'a', $s);
		$s = str_replace(array('ï', 'î'), 'i', $s);
		$s = str_replace(array('ö', 'ô'), 'o', $s);
		$s = str_replace(array('ù', 'ü', 'û'), 'u', $s);
		$s = str_replace('ç', 'c', $s);
	
		return $s;
	}
158873
protected function pathAction($s)
    {
        $s = strtolower($s);
        $s = preg_replace('#-(?=[a-z])#', ' ', $s);
        $s = preg_replace('#_(?=[a-z])#', ' ', $s);
        $s = substr(ucwords('x'.$s), 1);
        $s = str_replace(' ', '', $s);

        return $s;
    }
1178723
public static function serializeSig($r, $s)
    {
        $dec  = '';
        $byte = '';
        $seq  = '';

        $digits = array();
        $retval = array();

        for ($x = 0; $x < 256; $x++) {
            $digits[$x] = chr($x);
        }

        $dec = Util::decodeHex($r);

        while (Math::cmp($dec, '0') > 0) {
            $dv = Math::div($dec, '256');
            $rem = Math::mod($dec, '256');
            $dec = $dv;
            $byte = $byte.$digits[$rem];
        }

        $byte = strrev($byte);

        // msb check
        if (Math::cmp('0x'.bin2hex($byte[0]), '0'.'x80') >= 0) {
            $byte = chr(0x00).$byte;
        }

        $retval['bin_r'] = bin2hex($byte);
        $seq = chr(0x02).chr(strlen($byte)).$byte;
        $dec = Util::decodeHex($s);

        $byte = '';

        while (Math::cmp($dec, '0') > 0) {
            $dv = Math::div($dec, '256');
            $rem = Math::mod($dec, '256');
            $dec = $dv;
            $byte = $byte.$digits[$rem];
        }

        $byte = strrev($byte);

        // msb check
        if (Math::cmp('0x'.bin2hex($byte[0]), '0'.'x80') >= 0) {
            $byte = chr(0x00).$byte;
        }

        $retval['bin_s'] = bin2hex($byte);
        $seq = $seq.chr(0x02).chr(strlen($byte)).$byte;
        $seq = chr(0x30).chr(strlen($seq)).$seq;
        $retval['seq'] = bin2hex($seq);

        return $retval;
    }
1075830
private function transliterateGerman($s)
    {
        $table = array(
            //'ä' => 'ae', //messes up with slovak -> they have ä -> a
            'ë' => 'e',
            'ï' => 'i',
            'ö' => 'oe',
            'ü' => 'ue',
            'Ä' => 'Ae',
            'Ë' => 'E',
            'Ï' => 'I',
            'Ö' => 'Oe',
            'Ü' => 'Ue',
            'ß' => 'ss',
        );
        return strtr($s, $table);
    }
132372
public static function toAscii($s)
	{
		$s = preg_replace('#[^\x09\x0A\x0D\x20-\x7E\xA0-\x{2FF}\x{370}-\x{10FFFF}]#u', '', $s);
		$s = strtr($s, '`\'"^~', "\x01\x02\x03\x04\x05");
		if (ICONV_IMPL === 'glibc') {
			$s = @iconv('UTF-8', 'WINDOWS-1250//TRANSLIT', $s); // intentionally @
			$s = strtr($s, "\xa5\xa3\xbc\x8c\xa7\x8a\xaa\x8d\x8f\x8e\xaf\xb9\xb3\xbe\x9c\x9a\xba\x9d\x9f\x9e"
				. "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3"
				. "\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8"
				. "\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\x96",
				"ALLSSSSTZZZallssstzzzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTsraaaalccceeeeiiddnnooooruuuuyt-");
		} else {
			$s = @iconv('UTF-8', 'ASCII//TRANSLIT', $s); // intentionally @
		}
		$s = str_replace(array('`', "'", '"', '^', '~'), '', $s);
		return strtr($s, "\x01\x02\x03\x04\x05", '`\'"^~');
	}
42129
public static function save(array $s): string
    {
        $languages = Languages::getPairs();
        if (!$languages) {
            // No languages
            return '';
        }

        if (!is_array($s) || !$s) {
            // No string supplied
            return '';
        }

        $data = [];

        foreach ($s as $k => $v) {
            if (!isset($languages[$k])) {
                // No language with this key
                $v = NULL;
            }

            $data[$k] = $v;
        }

        return (string)Translation::getInstance()
            ->loadDataFromArray($data)
            ->save()
            ->getId();
    }
71769
private function sanitize($st){
    $st = trim((string)$st);
    if ( strpos($st, ';') !== false ){
      return '';
    }
    if ( strpos($st, '<') !== false ){
      return '';
    }
    if ( strpos($st, '"') !== false ){
      return '';
    }
    if ( strpos($st, "'") !== false ){
      return '';
    }
    return $st;
  }
753822
public function addslashes($s) {
        // Postgres is gradually switching to ANSI quotes, we need to check what is expected
        if (!isset($this->std_strings)) {
            $this->std_strings = ($this->mdb->get_field_sql("select setting from pg_settings where name = 'standard_conforming_strings'") === 'on');
        }

        if ($this->std_strings) {
            $s = str_replace("'",  "''", $s);
        } else {
            // do not use php addslashes() because it depends on PHP quote settings!
            $s = str_replace('\\','\\\\',$s);
            $s = str_replace("\0","\\\0", $s);
            $s = str_replace("'",  "\\'", $s);
        }

        return $s;
    }
530335
private static function normalizePath($s)
    {
        $i = self::needsNormalization($s);
        if ($i !== false) {

            $ac = str_split($s, 1);
            $ai = array_fill(0, $i, 0);

            try {
                self::split($ac, $ai);
            } catch (\OutOfBoundsException $e) {
                // something strange here )
            }
            self::removeDots($ac, $ai);
            self::leadingDots($ac, $ai);

            $i = self::join($ac, $ai);
            return implode('', array_slice($ac, 0, $i));
        } else {
            return $s;
        }
    }
1150825
private function _transliterateFrench ($s)
    {        
        $table = array (
            'â' => 'a',
            'ê' => 'e',
            'î' => 'i',
            'ô' => 'o',
            'û' => 'u',
            'Â' => 'A',
            'Ê' => 'E',
            'Î' => 'I',
            'Ô' => 'O',
            'Û' => 'U',
            'œ' => 'oe',
            'æ' => 'ae',
            'Ÿ' => 'Y',
            'ç' => 'c',
        	'Ç' => 'C',
        );
        return strtr($s, $table);
    }
995201
public static function normalize(string $s): string
    {
        if (\class_exists('\Normalizer', false)) {
            // convert to compressed normal form (NFC)
            $s = \Normalizer::normalize($s, \Normalizer::FORM_C);
        }

        $s = static::normalizeNewLines($s);

        // remove control characters; leave \t + \n
        $s = \preg_replace('#[\x00-\x08\x0B-\x1F\x7F-\x9F]+#u', '', $s);

        // right trim
        $s = \preg_replace('#[\t ]+$#m', '', $s);

        // leading and trailing blank lines
        $s = \trim($s, "\n");

        return $s;
    }
1114227
private function path2action($s)
	{
		$s = strtolower($s);
		$s = preg_replace('#-(?=[a-z])#', ' ', $s);
		$s = substr(ucwords('x' . $s), 1);
		//$s = lcfirst(ucwords($s));
		$s = str_replace(' ', '', $s);
		return $s;
	}