Determine if this path's name contains a substring.

@param string       $needle        The substring to search for.
@param boolean|null $caseSensitive True if case sensitive.

@return boolean True if this path's name contains the substring.
11941
public function nameContains($needle, $caseSensitive = null)
    {
        if ('' === $needle) {
            return true;
        }
        if (null === $caseSensitive) {
            $caseSensitive = false;
        }

        if ($caseSensitive) {
            return false !== mb_strpos($this->name(), $needle);
        }

        return false !== mb_stripos($this->name(), $needle);
    }
463830
public static function contains($string = false, $substring = false) {

        if ($substring && $substring && strpos($string, $substring) !== false) {

            return true;
        }

        return false;
    }
1043630
public static function containsCaseless($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            $needle = preg_quote($needle);
            if ($needle != '' && preg_match("/$needle/iu", $haystack)) {
                return true;
            }
        }

        return false;
    }
168266
public static function endsWith($needle, $haystack, $caseSensitive = true)
    {
        list($needle, $haystack) = self::transformCase($needle, $haystack, $caseSensitive);

        return (self::substring($haystack, -(self::length($needle))) === $needle);
    }
336391
public static function endsWith($haystack, $needle, $ignoreCase = false)
    {
        if ($ignoreCase) {
            return strripos($haystack, $needle) === strlen($haystack) - strlen($needle);
        } else {
            return substr_compare($haystack, $needle, -strlen($needle)) === 0;
        }

    }
913952
public static function endsWith(
        string $haystack,
        string $needle,
        $caseSensitive = true
    ) : bool {
        $needleLength = strlen($needle);
        $cmp = substr_compare(
            $haystack,
            $needle,
            -($needleLength),
            $needleLength,
            !$caseSensitive
        );

        return $cmp === 0;
    }
1113406
public static function contains($needle, $haystack, $caseSensitive = true)
    {
        if (!self::isValid($haystack)) {
            return false;
        }

        list($needle, $haystack) = self::transformCase($needle, $haystack, $caseSensitive);

        return (mb_strpos($haystack, $needle) !== false);
    }
1128123
public static function contains($val, $needle): bool
    {
        if (!$val || !\is_string($val)) {
            return false;
        }

        if (\is_string($needle) || \is_int($needle)) {
            return \stripos($val, (string)$needle) !== false;
        }

        if (\is_array($needle)) {
            foreach ((array)$needle as $item) {
                if (\stripos($val, $item) !== false) {
                    return true;
                }
            }
        }

        return false;
    }
1264102
public static function endsWith(
        string $haystack,
        string $needle,
        bool $caseSensitive = false
    ): bool
    {
        $test = substr($haystack, -strlen($needle));
        return ($caseSensitive === false)
            ? strcasecmp($test, $needle) === 0
            : strcmp($test, $needle) === 0;
    }
187255
protected function string_contains( $haystack, $needles ) {
		foreach ( (array) $needles as $needle ) {
			if ( '' !== $needle && mb_strpos( $haystack, $needle ) !== false ) {
				return true;
			}
		}

		return false;
	}
204758
public static boolean contains(final String value, final String needle, final boolean caseSensitive) {
        validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
        if (caseSensitive) {
            return value.contains(needle);
        }
        return value.toLowerCase().contains(needle.toLowerCase());
    }
821409
public static function contains($haystack, $needle, $checkAll = false) {
        $contains = false;

        if (is_string($needle)) {
            if (strstr($haystack, $needle)) {
                $contains =  true;
            } else {
                return $contains;
            }
        } else if (is_array($needle) && !$checkAll) {
            foreach ($needle as $check) {
                if (strstr($haystack, $check)) {
                    $contains = true;
                }
            }
        } else if (is_array($needle) && $checkAll) {
            $checked_needles = [];
            foreach ($needle as $check) {
                if (strstr($haystack, $check)) {
                    $checked_needles[] = $check;
                }
            }
            if (count($checked_needles) == count($needle)) {
                $contains = true;
            }
        }

        return $contains;
    }
921747
static function endsWith($string, $endsWith, $caseSensitive = true) {
		$len = self::strlen($endsWith);
		if ($caseSensitive) return self::substr($string, -1 * $len) == $endsWith;
		return self::strtolower(self::substr($string, -1 * $len)) == self::strtolower($endsWith);
	}
1180209
public static function containsOneOf($haystack, array $needles)
    {
        foreach ($needles as $needle) {
            if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
1077814
public static function hasEnding(string $needle, string $haystack): bool
    {
        return $needle === '' || substr($haystack, -strlen($needle)) === $needle;
    }
76339
public static function contains($haystack, $needles)
    {
        $needles = (array) $needles;

        foreach ($needles as $needle) {
            if ($needle && strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
217100
public function countSubstring($substring, $caseSensitive = true) {
		$this->verifyNotEmpty($substring, '$substring');
		if ($caseSensitive) {
			return mb_substr_count($this->string, $substring, $this->encoding);
		}
		$str = mb_strtoupper($this->string, $this->encoding);
		$substring = mb_strtoupper($substring, $this->encoding);
		return mb_substr_count($str, $substring, $this->encoding);
	}