|
@@ 1264-1270 (lines=7) @@
|
| 1261 |
|
* @link http://php.net/manual/en/function.substr |
| 1262 |
|
* @link http://php.net/manual/en/function.mb-substr |
| 1263 |
|
*/ |
| 1264 |
|
function api_substr($string, $start, $length = null, $encoding = null) |
| 1265 |
|
{ |
| 1266 |
|
if (is_null($length)) { |
| 1267 |
|
$length = api_strlen($string, $encoding); |
| 1268 |
|
} |
| 1269 |
|
return Utf8::substr($string, $start, $length); |
| 1270 |
|
} |
| 1271 |
|
|
| 1272 |
|
/** |
| 1273 |
|
* Counts the number of substring occurrences. |
|
@@ 1306-1313 (lines=8) @@
|
| 1303 |
|
* This function is aimed at replacing the function substr_replace() for human-language strings. |
| 1304 |
|
* @link http://php.net/manual/function.substr-replace |
| 1305 |
|
*/ |
| 1306 |
|
function api_substr_replace($string, $replacement, $start, $length = null, $encoding = null) |
| 1307 |
|
{ |
| 1308 |
|
if (is_null($length)) { |
| 1309 |
|
$length = api_strlen($string); |
| 1310 |
|
} |
| 1311 |
|
|
| 1312 |
|
return UTf8::substr_replace($string, $replacement, $start, $length); |
| 1313 |
|
} |
| 1314 |
|
|
| 1315 |
|
/** |
| 1316 |
|
* Makes a string's first character uppercase. |