Stringy\Stringy::contains PHP Méthode

contains() public méthode

Returns true if the string contains $needle, false otherwise. By default the comparison is case-sensitive, but can be made insensitive by setting $caseSensitive to false.
public contains ( string $needle, boolean $caseSensitive = true ) : boolean
$needle string Substring to look for
$caseSensitive boolean Whether or not to enforce case-sensitivity
Résultat boolean Whether or not $str contains $needle
    public function contains($needle, $caseSensitive = true)
    {
        $encoding = $this->encoding;
        if ($caseSensitive) {
            return \mb_strpos($this->str, $needle, 0, $encoding) !== false;
        }
        return \mb_stripos($this->str, $needle, 0, $encoding) !== false;
    }