|
@@ 1385-1396 (lines=12) @@
|
| 1382 |
|
* |
| 1383 |
|
* @return static Object having a $str without the prefix $substring |
| 1384 |
|
*/ |
| 1385 |
|
public function removeLeft($substring) |
| 1386 |
|
{ |
| 1387 |
|
$stringy = static::create($this->str, $this->encoding); |
| 1388 |
|
|
| 1389 |
|
if ($stringy->startsWith($substring)) { |
| 1390 |
|
$substringLength = UTF8::strlen($substring, $stringy->encoding); |
| 1391 |
|
|
| 1392 |
|
return $stringy->substr($substringLength); |
| 1393 |
|
} |
| 1394 |
|
|
| 1395 |
|
return $stringy; |
| 1396 |
|
} |
| 1397 |
|
|
| 1398 |
|
/** |
| 1399 |
|
* Returns a new string with the suffix $substring removed, if present. |
|
@@ 1405-1416 (lines=12) @@
|
| 1402 |
|
* |
| 1403 |
|
* @return static Object having a $str without the suffix $substring |
| 1404 |
|
*/ |
| 1405 |
|
public function removeRight($substring) |
| 1406 |
|
{ |
| 1407 |
|
$stringy = static::create($this->str, $this->encoding); |
| 1408 |
|
|
| 1409 |
|
if ($stringy->endsWith($substring)) { |
| 1410 |
|
$substringLength = UTF8::strlen($substring, $stringy->encoding); |
| 1411 |
|
|
| 1412 |
|
return $stringy->substr(0, $stringy->length() - $substringLength); |
| 1413 |
|
} |
| 1414 |
|
|
| 1415 |
|
return $stringy; |
| 1416 |
|
} |
| 1417 |
|
|
| 1418 |
|
/** |
| 1419 |
|
* Returns a repeated string given a multiplier. |