| @@ 5899-5917 (lines=19) @@ | ||
| 5896 | * |
|
| 5897 | * @return string <p>Return the sub-string.</p> |
|
| 5898 | */ |
|
| 5899 | public static function substr_ileft($haystack, $needle) |
|
| 5900 | { |
|
| 5901 | // init |
|
| 5902 | $haystack = (string)$haystack; |
|
| 5903 | $needle = (string)$needle; |
|
| 5904 | ||
| 5905 | if (!isset($haystack[0])) { |
|
| 5906 | return ''; |
|
| 5907 | } |
|
| 5908 | ||
| 5909 | if (!isset($needle[0])) { |
|
| 5910 | return $haystack; |
|
| 5911 | } |
|
| 5912 | ||
| 5913 | if (self::str_istarts_with($haystack, $needle) === true) { |
|
| 5914 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 5915 | } |
|
| 5916 | ||
| 5917 | return $haystack; |
|
| 5918 | } |
|
| 5919 | ||
| 5920 | /** |
|
| @@ 5928-5946 (lines=19) @@ | ||
| 5925 | * |
|
| 5926 | * @return string <p>Return the sub-string.</p> |
|
| 5927 | */ |
|
| 5928 | public static function substr_iright($haystack, $needle) |
|
| 5929 | { |
|
| 5930 | // init |
|
| 5931 | $haystack = (string)$haystack; |
|
| 5932 | $needle = (string)$needle; |
|
| 5933 | ||
| 5934 | if (!isset($haystack[0])) { |
|
| 5935 | return ''; |
|
| 5936 | } |
|
| 5937 | ||
| 5938 | if (!isset($needle[0])) { |
|
| 5939 | return $haystack; |
|
| 5940 | } |
|
| 5941 | ||
| 5942 | if (self::str_iends_with($haystack, $needle) === true) { |
|
| 5943 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 5944 | } |
|
| 5945 | ||
| 5946 | return $haystack; |
|
| 5947 | } |
|
| 5948 | ||
| 5949 | /** |
|
| @@ 5957-5975 (lines=19) @@ | ||
| 5954 | * |
|
| 5955 | * @return string <p>Return the sub-string.</p> |
|
| 5956 | */ |
|
| 5957 | public static function substr_left($haystack, $needle) |
|
| 5958 | { |
|
| 5959 | // init |
|
| 5960 | $haystack = (string)$haystack; |
|
| 5961 | $needle = (string)$needle; |
|
| 5962 | ||
| 5963 | if (!isset($haystack[0])) { |
|
| 5964 | return ''; |
|
| 5965 | } |
|
| 5966 | ||
| 5967 | if (!isset($needle[0])) { |
|
| 5968 | return $haystack; |
|
| 5969 | } |
|
| 5970 | ||
| 5971 | if (self::str_starts_with($haystack, $needle) === true) { |
|
| 5972 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 5973 | } |
|
| 5974 | ||
| 5975 | return $haystack; |
|
| 5976 | } |
|
| 5977 | ||
| 5978 | /** |
|
| @@ 6084-6102 (lines=19) @@ | ||
| 6081 | * |
|
| 6082 | * @return string <p>Return the sub-string.</p> |
|
| 6083 | */ |
|
| 6084 | public static function substr_right($haystack, $needle) |
|
| 6085 | { |
|
| 6086 | $haystack = (string)$haystack; |
|
| 6087 | $needle = (string)$needle; |
|
| 6088 | ||
| 6089 | if (!isset($haystack[0])) { |
|
| 6090 | return ''; |
|
| 6091 | } |
|
| 6092 | ||
| 6093 | if (!isset($needle[0])) { |
|
| 6094 | return $haystack; |
|
| 6095 | } |
|
| 6096 | ||
| 6097 | if (self::str_ends_with($haystack, $needle) === true) { |
|
| 6098 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 6099 | } |
|
| 6100 | ||
| 6101 | return $haystack; |
|
| 6102 | } |
|
| 6103 | ||
| 6104 | /** |
|
| 6105 | * Returns a case swapped version of the string. |
|