Exemple #1
0
 /**
  * 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.
  *
  * @param  string $needle        Substring to look for
  * @param  bool   $caseSensitive Whether or not to enforce case-sensitivity
  *
  * @return bool   Whether or not $str contains $needle
  */
 public function contains($needle, $caseSensitive = true)
 {
     $encoding = $this->encoding;
     if ($caseSensitive) {
         return UTF8::strpos($this->str, $needle, 0, $encoding) !== false;
     } else {
         return UTF8::stripos($this->str, $needle, 0, $encoding) !== false;
     }
 }