@@ 41-49 (lines=9) @@ | ||
38 | * @param string|array $needles |
|
39 | * @return bool |
|
40 | */ |
|
41 | public static function startsWith($haystack, $needles) |
|
42 | { |
|
43 | foreach ((array) $needles as $needle) { |
|
44 | if ($needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) { |
|
45 | return true; |
|
46 | } |
|
47 | } |
|
48 | return false; |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Determine if a given string ends with a given substring. |
|
@@ 58-66 (lines=9) @@ | ||
55 | * @param string|array $needles |
|
56 | * @return bool |
|
57 | */ |
|
58 | public static function endsWith($haystack, $needles) |
|
59 | { |
|
60 | foreach ((array) $needles as $needle) { |
|
61 | if (substr($haystack, -strlen($needle)) === (string) $needle) { |
|
62 | return true; |
|
63 | } |
|
64 | } |
|
65 | return false; |
|
66 | } |
|
67 | ||
68 | /** |
|
69 | * Convert a string to snake case. |