Lines Matching +full:- +full:i
6 * Methods to assess and clean UTF-8 strings
13 * @author Andreas Haerter <andreas.haerter@dev.mail-node.com>
20 return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1);
27 * @link http://php.net/manual/en/function.utf8-encode.php
35 for ($i = 0; $i < $len; $i++) {
36 $b = ord($str[$i]);
46 if ((++$i === $len) || ((ord($str[$i]) & 0xC0) !== 0x80))
67 for ($i = 0; $i < $len; $i++) {
68 if (ord($str[$i]) < 128) {
69 $ascii .= $str[$i];
76 * Removes special characters (nonalphanumeric) from a UTF-8 string
95 return preg_replace('/[' . $additional . '\x00-\x19' . $specials . ']/u', $repl, $string);
103 * PCRE Pattern to locate bad bytes in a UTF-8 string
108 * @see http://www.w3.org/International/questions/qa-forms-utf-8
111 * @param string $replace to replace bad bytes with (defaults to '?') - use ASCII
117 '([\x00-\x7F]' . # ASCII (including control chars)
118 '|[\xC2-\xDF][\x80-\xBF]' . # non-overlong 2-byte
119 '|\xE0[\xA0-\xBF][\x80-\xBF]' . # excluding overlongs
120 '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}' . # straight 3-byte
121 '|\xED[\x80-\x9F][\x80-\xBF]' . # excluding surrogates
122 '|\xF0[\x90-\xBF][\x80-\xBF]{2}' . # planes 1-3
123 '|[\xF1-\xF3][\x80-\xBF]{3}' . # planes 4-15
124 '|\xF4[\x80-\x8F][\x80-\xBF]{2}' . # plane 16
140 * Replace accented UTF-8 characters by unaccented ASCII-7 equivalents
142 * Use the optional parameter to just deaccent lower ($case = -1) or upper ($case = 1)
163 * Romanize a non-latin string
183 * @param int $i byte index into $str
187 public static function correctIdx($str, $i, $next = false) argument
190 if ($i <= 0) return 0;
193 if ($i >= $limit) return $limit;
196 while (($i < $limit) && ((ord($str[$i]) & 0xC0) === 0x80)) $i++;
198 while ($i && ((ord($str[$i]) & 0xC0) === 0x80)) $i--;
201 return $i;