| @@ 6025-6043 (lines=19) @@ | ||
| 6022 | * |
|
| 6023 | * @return string <p>Return the sub-string.</p> |
|
| 6024 | */ |
|
| 6025 | public static function substr_ileft($haystack, $needle) |
|
| 6026 | { |
|
| 6027 | // init |
|
| 6028 | $haystack = (string)$haystack; |
|
| 6029 | $needle = (string)$needle; |
|
| 6030 | ||
| 6031 | if (!isset($haystack[0])) { |
|
| 6032 | return ''; |
|
| 6033 | } |
|
| 6034 | ||
| 6035 | if (!isset($needle[0])) { |
|
| 6036 | return $haystack; |
|
| 6037 | } |
|
| 6038 | ||
| 6039 | if (self::str_istarts_with($haystack, $needle) === true) { |
|
| 6040 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 6041 | } |
|
| 6042 | ||
| 6043 | return $haystack; |
|
| 6044 | } |
|
| 6045 | ||
| 6046 | /** |
|
| @@ 6054-6072 (lines=19) @@ | ||
| 6051 | * |
|
| 6052 | * @return string <p>Return the sub-string.</p> |
|
| 6053 | */ |
|
| 6054 | public static function substr_iright($haystack, $needle) |
|
| 6055 | { |
|
| 6056 | // init |
|
| 6057 | $haystack = (string)$haystack; |
|
| 6058 | $needle = (string)$needle; |
|
| 6059 | ||
| 6060 | if (!isset($haystack[0])) { |
|
| 6061 | return ''; |
|
| 6062 | } |
|
| 6063 | ||
| 6064 | if (!isset($needle[0])) { |
|
| 6065 | return $haystack; |
|
| 6066 | } |
|
| 6067 | ||
| 6068 | if (self::str_iends_with($haystack, $needle) === true) { |
|
| 6069 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 6070 | } |
|
| 6071 | ||
| 6072 | return $haystack; |
|
| 6073 | } |
|
| 6074 | ||
| 6075 | /** |
|
| @@ 6083-6101 (lines=19) @@ | ||
| 6080 | * |
|
| 6081 | * @return string <p>Return the sub-string.</p> |
|
| 6082 | */ |
|
| 6083 | public static function substr_left($haystack, $needle) |
|
| 6084 | { |
|
| 6085 | // init |
|
| 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_starts_with($haystack, $needle) === true) { |
|
| 6098 | $haystack = self::substr($haystack, self::strlen($needle)); |
|
| 6099 | } |
|
| 6100 | ||
| 6101 | return $haystack; |
|
| 6102 | } |
|
| 6103 | ||
| 6104 | /** |
|
| @@ 6210-6228 (lines=19) @@ | ||
| 6207 | * |
|
| 6208 | * @return string <p>Return the sub-string.</p> |
|
| 6209 | */ |
|
| 6210 | public static function substr_right($haystack, $needle) |
|
| 6211 | { |
|
| 6212 | $haystack = (string)$haystack; |
|
| 6213 | $needle = (string)$needle; |
|
| 6214 | ||
| 6215 | if (!isset($haystack[0])) { |
|
| 6216 | return ''; |
|
| 6217 | } |
|
| 6218 | ||
| 6219 | if (!isset($needle[0])) { |
|
| 6220 | return $haystack; |
|
| 6221 | } |
|
| 6222 | ||
| 6223 | if (self::str_ends_with($haystack, $needle) === true) { |
|
| 6224 | $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle)); |
|
| 6225 | } |
|
| 6226 | ||
| 6227 | return $haystack; |
|
| 6228 | } |
|
| 6229 | ||
| 6230 | /** |
|
| 6231 | * Returns a case swapped version of the string. |
|