diff --git a/README.md b/README.md index 172f7b4..d1d5016 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy' * [shuffle](#shuffle) * [slugify](#slugify-string-replacement----) * [startsWith](#startswithstring-substring--boolean-casesensitive--true-) + * [startsWithAny](#startswithstring-substrings--boolean-casesensitive--true-) * [slice](#sliceint-start--int-end-) * [split](#splitstring-pattern--int-limit-) * [stripWhitespace](#stripwhitespace) @@ -774,6 +775,16 @@ by setting $caseSensitive to false. s('FÒÔbàřbaz')->startsWith('fòôbàř', false); // true ``` +##### startsWithAny(string[] $substrings [, boolean $caseSensitive = true ]) + +Returns true if the string begins with any of $substrings, false +otherwise. By default the comparison is case-sensitive, but can be made +insensitive by setting $caseSensitive to false. + +```php +s('FÒÔbàřbaz')->startsWith(['fòô', 'bàř'], false); // true +``` + ##### slice(int $start [, int $end ]) Returns the substring beginning at $start, and up to, but not including diff --git a/src/Stringy.php b/src/Stringy.php index 2e4bac0..9869da2 100644 --- a/src/Stringy.php +++ b/src/Stringy.php @@ -1171,13 +1171,14 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess } /** - * Returns true if the string begins with any $substrings, false otherwise. By - * default the comparison is case-sensitive, but can be made insensitive by - * setting $caseSensitive to false. + * Returns true if the string begins with any of $substrings, false + * otherwise. By default the comparison is case-sensitive, but can be made + * insensitive by setting $caseSensitive to false. * - * @param array $substrings Substrings to look for - * @param bool $caseSensitive Whether or not to enforce case-sensitivity - * @return bool Whether or not $str starts with $substring + * @param string[] $substrings Substrings to look for + * @param bool $caseSensitive Whether or not to enforce + * case-sensitivity + * @return bool Whether or not $str starts with $substring */ public function startsWithAny($substrings, $caseSensitive = true) {