diff options
Diffstat (limited to 'vendor/nelexa/zip/src/PhpZip/Util/StringUtil.php')
-rw-r--r-- | vendor/nelexa/zip/src/PhpZip/Util/StringUtil.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/nelexa/zip/src/PhpZip/Util/StringUtil.php b/vendor/nelexa/zip/src/PhpZip/Util/StringUtil.php new file mode 100644 index 0000000..0b75040 --- /dev/null +++ b/vendor/nelexa/zip/src/PhpZip/Util/StringUtil.php @@ -0,0 +1,31 @@ +<?php + +namespace PhpZip\Util; + +/** + * String Util + */ +class StringUtil +{ + + /** + * @param string $haystack + * @param string $needle + * @return bool + */ + public static function startsWith($haystack, $needle) + { + return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; + } + + /** + * @param string $haystack + * @param string $needle + * @return bool + */ + public static function endsWith($haystack, $needle) + { + return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 + && strpos($haystack, $needle, $temp) !== false); + } +} |