@@ -56,10 +56,18 @@ |
||
| 56 | 56 | return static::isEmpty($a) || static::startsWith($a, $b . ' |') | static::endsWith($a, '| ' . $b); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + /** |
|
| 60 | + * @param string $haystack |
|
| 61 | + * @param string $needle |
|
| 62 | + */ |
|
| 59 | 63 | static public function startsWith($haystack, $needle) { |
| 60 | 64 | return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; |
| 61 | 65 | } |
| 62 | 66 | |
| 67 | + /** |
|
| 68 | + * @param string $haystack |
|
| 69 | + * @param string $needle |
|
| 70 | + */ |
|
| 63 | 71 | static public function endsWith($haystack, $needle) { |
| 64 | 72 | return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false); |
| 65 | 73 | } |