| @@ 6351-6369 (lines=19) @@ | ||
| 6348 | * |
|
| 6349 | * @return string <p>Return the sub-string.</p> |
|
| 6350 | */ |
|
| 6351 | public static function substr_ileft($haystack, $needle) |
|
| 6352 | { |
|
| 6353 | // init |
|
| 6354 | $haystack = (string)$haystack; |
|
| 6355 | $needle = (string)$needle; |
|
| 6356 | ||
| 6357 | if (!isset($haystack[0])) { |
|
| 6358 | return ''; |
|
| 6359 | } |
|
| 6360 | ||
| 6361 | if (!isset($needle[0])) { |
|
| 6362 | return $haystack; |
|
| 6363 | } |
|
| 6364 | ||
| 6365 | if (self::str_istarts_with($haystack, $needle) === true) { |
|
| 6366 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 6367 | } |
|
| 6368 | ||
| 6369 | return $haystack; |
|
| 6370 | } |
|
| 6371 | ||
| 6372 | /** |
|
| @@ 6380-6398 (lines=19) @@ | ||
| 6377 | * |
|
| 6378 | * @return string <p>Return the sub-string.</p> |
|
| 6379 | */ |
|
| 6380 | public static function substr_iright($haystack, $needle) |
|
| 6381 | { |
|
| 6382 | // init |
|
| 6383 | $haystack = (string)$haystack; |
|
| 6384 | $needle = (string)$needle; |
|
| 6385 | ||
| 6386 | if (!isset($haystack[0])) { |
|
| 6387 | return ''; |
|
| 6388 | } |
|
| 6389 | ||
| 6390 | if (!isset($needle[0])) { |
|
| 6391 | return $haystack; |
|
| 6392 | } |
|
| 6393 | ||
| 6394 | if (self::str_iends_with($haystack, $needle) === true) { |
|
| 6395 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 6396 | } |
|
| 6397 | ||
| 6398 | return $haystack; |
|
| 6399 | } |
|
| 6400 | ||
| 6401 | /** |
|
| @@ 6409-6427 (lines=19) @@ | ||
| 6406 | * |
|
| 6407 | * @return string <p>Return the sub-string.</p> |
|
| 6408 | */ |
|
| 6409 | public static function substr_left($haystack, $needle) |
|
| 6410 | { |
|
| 6411 | // init |
|
| 6412 | $haystack = (string)$haystack; |
|
| 6413 | $needle = (string)$needle; |
|
| 6414 | ||
| 6415 | if (!isset($haystack[0])) { |
|
| 6416 | return ''; |
|
| 6417 | } |
|
| 6418 | ||
| 6419 | if (!isset($needle[0])) { |
|
| 6420 | return $haystack; |
|
| 6421 | } |
|
| 6422 | ||
| 6423 | if (self::str_starts_with($haystack, $needle) === true) { |
|
| 6424 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 6425 | } |
|
| 6426 | ||
| 6427 | return $haystack; |
|
| 6428 | } |
|
| 6429 | ||
| 6430 | /** |
|
| @@ 6535-6553 (lines=19) @@ | ||
| 6532 | * |
|
| 6533 | * @return string <p>Return the sub-string.</p> |
|
| 6534 | */ |
|
| 6535 | public static function substr_right($haystack, $needle) |
|
| 6536 | { |
|
| 6537 | $haystack = (string)$haystack; |
|
| 6538 | $needle = (string)$needle; |
|
| 6539 | ||
| 6540 | if (!isset($haystack[0])) { |
|
| 6541 | return ''; |
|
| 6542 | } |
|
| 6543 | ||
| 6544 | if (!isset($needle[0])) { |
|
| 6545 | return $haystack; |
|
| 6546 | } |
|
| 6547 | ||
| 6548 | if (self::str_ends_with($haystack, $needle) === true) { |
|
| 6549 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 6550 | } |
|
| 6551 | ||
| 6552 | return $haystack; |
|
| 6553 | } |
|
| 6554 | ||
| 6555 | /** |
|
| 6556 | * Returns a case swapped version of the string. |
|