1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-10 23:34:00 +02:00

Add startsWithAny to readme

This commit is contained in:
Daniel St. Jules
2017-02-28 23:23:43 -05:00
parent 553bf37acb
commit 6f2e2851ac
2 changed files with 18 additions and 6 deletions

View File

@@ -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

View File

@@ -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)
{