1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-12 08:14:06 +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) * [shuffle](#shuffle)
* [slugify](#slugify-string-replacement----) * [slugify](#slugify-string-replacement----)
* [startsWith](#startswithstring-substring--boolean-casesensitive--true-) * [startsWith](#startswithstring-substring--boolean-casesensitive--true-)
* [startsWithAny](#startswithstring-substrings--boolean-casesensitive--true-)
* [slice](#sliceint-start--int-end-) * [slice](#sliceint-start--int-end-)
* [split](#splitstring-pattern--int-limit-) * [split](#splitstring-pattern--int-limit-)
* [stripWhitespace](#stripwhitespace) * [stripWhitespace](#stripwhitespace)
@@ -774,6 +775,16 @@ by setting $caseSensitive to false.
s('FÒÔbàřbaz')->startsWith('fòôbàř', false); // true 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 ]) ##### slice(int $start [, int $end ])
Returns the substring beginning at $start, and up to, but not including Returns the substring beginning at $start, and up to, but not including

View File

@@ -1171,12 +1171,13 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
} }
/** /**
* Returns true if the string begins with any $substrings, false otherwise. By * Returns true if the string begins with any of $substrings, false
* default the comparison is case-sensitive, but can be made insensitive by * otherwise. By default the comparison is case-sensitive, but can be made
* setting $caseSensitive to false. * insensitive by setting $caseSensitive to false.
* *
* @param array $substrings Substrings to look for * @param string[] $substrings Substrings to look for
* @param bool $caseSensitive Whether or not to enforce case-sensitivity * @param bool $caseSensitive Whether or not to enforce
* case-sensitivity
* @return bool Whether or not $str starts with $substring * @return bool Whether or not $str starts with $substring
*/ */
public function startsWithAny($substrings, $caseSensitive = true) public function startsWithAny($substrings, $caseSensitive = true)