| @@ 70-78 (lines=9) @@ | ||
| 67 | * @param string|array $needles |
|
| 68 | * @return bool |
|
| 69 | */ |
|
| 70 | public static function endsWith($haystack, $needles) |
|
| 71 | { |
|
| 72 | foreach ((array)$needles as $needle) { |
|
| 73 | if (substr($haystack, -strlen($needle)) === (string)$needle) { |
|
| 74 | return true; |
|
| 75 | } |
|
| 76 | } |
|
| 77 | return false; |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * Cap a string with a single instance of a given value. |
|
| @@ 218-226 (lines=9) @@ | ||
| 215 | * @param string|array $needles |
|
| 216 | * @return bool |
|
| 217 | */ |
|
| 218 | public static function contains($haystack, $needles) |
|
| 219 | { |
|
| 220 | foreach ((array)$needles as $needle) { |
|
| 221 | if ($needle != '' && mb_strpos($haystack, $needle) !== false) { |
|
| 222 | return true; |
|
| 223 | } |
|
| 224 | } |
|
| 225 | return false; |
|
| 226 | } |
|
| 227 | ||
| 228 | /** |
|
| 229 | * Get the plural form of an English word. |
|
| @@ 901-909 (lines=9) @@ | ||
| 898 | * @param string|array $needles |
|
| 899 | * @return bool |
|
| 900 | */ |
|
| 901 | public static function startsWith($haystack, $needles) |
|
| 902 | { |
|
| 903 | foreach ((array)$needles as $needle) { |
|
| 904 | if ($needle != '' && substr($haystack, 0, strlen($needle)) === (string)$needle) { |
|
| 905 | return true; |
|
| 906 | } |
|
| 907 | } |
|
| 908 | return false; |
|
| 909 | } |
|
| 910 | ||
| 911 | /** |
|
| 912 | * Make a string's first character uppercase. |
|