From 3cc12c2ee7277c008b7da4a0582c70e063f5d850 Mon Sep 17 00:00:00 2001 From: "Daniel St. Jules" Date: Tue, 14 Oct 2014 23:25:43 -0700 Subject: [PATCH] Added containsAll and containsAny to readme --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 584eb2a..248b3df 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ PHP 5.3+ and HHVM. Inspired by underscore.string.js. * [chars](#chars) * [collapseWhitespace](#collapsewhitespace) * [contains](#contains) + * [containsAll](#containsall) + * [containsAny](#containsany) * [countSubstr](#countsubstr) * [create](#create) * [dasherize](#dasherize) @@ -249,6 +251,36 @@ S::create('Ο συγγραφέας είπε', 'UTF-8')->contains('συγγραφ S::contains('Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8'); // true ``` +#### containsAll + +$stringy->containsAll(array $needles [, boolean $caseSensitive = true ]) + +S::containsAll(string $haystack, array $needles [, boolean $caseSensitive = true [, string $encoding ]]) + +Returns true if the string contains all $needles, false otherwise. By +default the comparison is case-sensitive, but can be made insensitive by +setting $caseSensitive to false. + +```php +S::create('Str contains foo and bar')->containsAll(array('foo', 'bar')); +S::containsAll('Str contains foo and bar', array('foo', 'bar')); // true +``` + +#### containsAny + +$stringy->containsAny(array $needles [, boolean $caseSensitive = true ]) + +S::containsAny(string $haystack, array $needles [, boolean $caseSensitive = true [, string $encoding ]]) + +Returns true if the string contains any $needles, false otherwise. By +default the comparison is case-sensitive, but can be made insensitive by +setting $caseSensitive to false. + +```php +S::create('Str contains foo')->containsAny(array('foo', 'bar')); +S::containsAny('Str contains foo', array('foo', 'bar')); // true +``` + #### countSubstr $stringy->countSubstr(string $substring [, boolean $caseSensitive = true ])