|
@@ 1353-1364 (lines=12) @@
|
| 1350 |
|
* |
| 1351 |
|
* @return static Object having a $str without the prefix $substring |
| 1352 |
|
*/ |
| 1353 |
|
public function removeLeft($substring) |
| 1354 |
|
{ |
| 1355 |
|
$stringy = static::create($this->str, $this->encoding); |
| 1356 |
|
|
| 1357 |
|
if ($stringy->startsWith($substring)) { |
| 1358 |
|
$substringLength = UTF8::strlen($substring, $stringy->encoding); |
| 1359 |
|
|
| 1360 |
|
return $stringy->substr($substringLength); |
| 1361 |
|
} |
| 1362 |
|
|
| 1363 |
|
return $stringy; |
| 1364 |
|
} |
| 1365 |
|
|
| 1366 |
|
/** |
| 1367 |
|
* Returns a new string with the suffix $substring removed, if present. |
|
@@ 1373-1384 (lines=12) @@
|
| 1370 |
|
* |
| 1371 |
|
* @return static Object having a $str without the suffix $substring |
| 1372 |
|
*/ |
| 1373 |
|
public function removeRight($substring) |
| 1374 |
|
{ |
| 1375 |
|
$stringy = static::create($this->str, $this->encoding); |
| 1376 |
|
|
| 1377 |
|
if ($stringy->endsWith($substring)) { |
| 1378 |
|
$substringLength = UTF8::strlen($substring, $stringy->encoding); |
| 1379 |
|
|
| 1380 |
|
return $stringy->substr(0, $stringy->length() - $substringLength); |
| 1381 |
|
} |
| 1382 |
|
|
| 1383 |
|
return $stringy; |
| 1384 |
|
} |
| 1385 |
|
|
| 1386 |
|
/** |
| 1387 |
|
* Returns a repeated string given a multiplier. |