Lines Matching refs:string

6  * UTF-8 aware equivalents to PHP's string functions
15 * @param string $path A path
16 * @param string $suffix If the name component ends in suffix this will also be cut off
17 * @return string
44 * @param string $string
51 public static function strlen($string)
54 return mb_strlen($string, 'UTF-8');
58 return iconv_strlen($string, 'UTF-8');
63 return strlen(utf8_decode($string));
66 return strlen($string);
72 * Return part of a string given character offset (and optionally length)
74 * @param string $str
77 * @return string
95 * no mb string support, so we'll use pcre regex's with 'u' flag
99 * substr documentation states false can be returned in some cases (e.g. offset > string length)
100 * mb_substr never returns false, it will return an empty string instead.
102 * calculating the number of characters in the string is a relatively expensive operation, so
107 $str = (string)$str; // generates E_NOTICE for PHP4 objects, but not PHP5 objects
138 $length_pattern = '(.*)$'; // the rest of the string
144 // reduce any length that would go past the end of the string
156 // anchored at the tail-end of the string
170 * @param string $string input string
171 * @param string $replacement the replacement
172 * @param int $start the replacing will begin at the start'th offset into string.
173 * @param int $length If given and is positive, it represents the length of the portion of string which is
175 * replacement into string at the given start offset.
176 * @return string
181 public static function substr_replace($string, $replacement, $start, $length = 0)
184 if ($start > 0) $ret .= self::substr($string, 0, $start);
186 $ret .= self::substr($string, $start + $length);
194 * @param string $str
195 * @param string $charlist
196 * @return string
214 * @param string $str
215 * @param string $charlist
216 * @return string
234 * @param string $str
235 * @param string $charlist
236 * @return string
253 * @param string $string
254 * @return string
260 public static function strtolower($string)
262 if ($string === null) return ''; // pre-8.1 behaviour
265 return \Normalizer::normalize(mb_strtolower($string, 'utf-8'));
267 return (mb_strtolower($string, 'utf-8'));
269 return strtr($string, Table::upperCaseToLowerCase());
277 * @param string $string
278 * @return string
284 public static function strtoupper($string)
286 if (UTF8_MBSTRING) return mb_strtoupper($string, 'utf-8');
288 return strtr($string, Table::lowerCaseToUpperCase());
294 * Make a string's first character uppercase
296 * @param string $str
297 * @return string with first character as upper case (if applicable)
316 * Uppercase the first character of each word in a string
318 * @param string $str
319 * @return string with first char of each word uppercase
346 * @param string $haystack
347 * @param string $needle