You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I encountered a use case where I had to check if a given string was contained in at least one of the values in a provided array. So, I thought that an isContained helper would be useful, something like this:
$isContained = Str::isContained('Lorem', ['Lorem ipsum dolor sit amet', 'Consectetur adipiscing elit']);
// true$isContained = Str::isContained('lorem', ['Lorem ipsum dolor sit amet', 'Consectetur adipiscing elit']);
// false$isContained = Str::isContained('lorem', ['Lorem ipsum dolor sit amet', 'Consectetur adipiscing elit'], ignoreCase: true);
// true
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey artisans! 👋
Recently, I encountered a use case where I had to check if a given string was contained in at least one of the values in a provided array. So, I thought that an
isContained
helper would be useful, something like this:Of course, I'm willing to implement it
Beta Was this translation helpful? Give feedback.
All reactions