| @@ 5823-5841 (lines=19) @@ | ||
| 5820 | * |
|
| 5821 | * @return string <p>Return the sub-string.</p> |
|
| 5822 | */ |
|
| 5823 | public static function substr_ileft($haystack, $needle) |
|
| 5824 | { |
|
| 5825 | // init |
|
| 5826 | $haystack = (string)$haystack; |
|
| 5827 | $needle = (string)$needle; |
|
| 5828 | ||
| 5829 | if (!isset($haystack[0])) { |
|
| 5830 | return ''; |
|
| 5831 | } |
|
| 5832 | ||
| 5833 | if (!isset($needle[0])) { |
|
| 5834 | return $haystack; |
|
| 5835 | } |
|
| 5836 | ||
| 5837 | if (self::str_istarts_with($haystack, $needle) === true) { |
|
| 5838 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 5839 | } |
|
| 5840 | ||
| 5841 | return $haystack; |
|
| 5842 | } |
|
| 5843 | ||
| 5844 | /** |
|
| @@ 5852-5870 (lines=19) @@ | ||
| 5849 | * |
|
| 5850 | * @return string <p>Return the sub-string.</p> |
|
| 5851 | */ |
|
| 5852 | public static function substr_iright($haystack, $needle) |
|
| 5853 | { |
|
| 5854 | // init |
|
| 5855 | $haystack = (string)$haystack; |
|
| 5856 | $needle = (string)$needle; |
|
| 5857 | ||
| 5858 | if (!isset($haystack[0])) { |
|
| 5859 | return ''; |
|
| 5860 | } |
|
| 5861 | ||
| 5862 | if (!isset($needle[0])) { |
|
| 5863 | return $haystack; |
|
| 5864 | } |
|
| 5865 | ||
| 5866 | if (self::str_iends_with($haystack, $needle) === true) { |
|
| 5867 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 5868 | } |
|
| 5869 | ||
| 5870 | return $haystack; |
|
| 5871 | } |
|
| 5872 | ||
| 5873 | /** |
|
| @@ 5881-5899 (lines=19) @@ | ||
| 5878 | * |
|
| 5879 | * @return string <p>Return the sub-string.</p> |
|
| 5880 | */ |
|
| 5881 | public static function substr_left($haystack, $needle) |
|
| 5882 | { |
|
| 5883 | // init |
|
| 5884 | $haystack = (string)$haystack; |
|
| 5885 | $needle = (string)$needle; |
|
| 5886 | ||
| 5887 | if (!isset($haystack[0])) { |
|
| 5888 | return ''; |
|
| 5889 | } |
|
| 5890 | ||
| 5891 | if (!isset($needle[0])) { |
|
| 5892 | return $haystack; |
|
| 5893 | } |
|
| 5894 | ||
| 5895 | if (self::str_starts_with($haystack, $needle) === true) { |
|
| 5896 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 5897 | } |
|
| 5898 | ||
| 5899 | return $haystack; |
|
| 5900 | } |
|
| 5901 | ||
| 5902 | /** |
|
| @@ 6008-6026 (lines=19) @@ | ||
| 6005 | * |
|
| 6006 | * @return string <p>Return the sub-string.</p> |
|
| 6007 | */ |
|
| 6008 | public static function substr_right($haystack, $needle) |
|
| 6009 | { |
|
| 6010 | $haystack = (string)$haystack; |
|
| 6011 | $needle = (string)$needle; |
|
| 6012 | ||
| 6013 | if (!isset($haystack[0])) { |
|
| 6014 | return ''; |
|
| 6015 | } |
|
| 6016 | ||
| 6017 | if (!isset($needle[0])) { |
|
| 6018 | return $haystack; |
|
| 6019 | } |
|
| 6020 | ||
| 6021 | if (self::str_ends_with($haystack, $needle) === true) { |
|
| 6022 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 6023 | } |
|
| 6024 | ||
| 6025 | return $haystack; |
|
| 6026 | } |
|
| 6027 | ||
| 6028 | /** |
|
| 6029 | * Returns a case swapped version of the string. |
|