Determine if the string exists in another string.
Twine\Str::in( string $string [ , string $mode = Twine\Config\In::CASE_SENSITIVE ] ) : bool
$string | The string to compare against |
$mode | Flag for case-sensitive and case-insensitive mode |
Available in mode flags:
Twine\Config\In::CASE_SENSITIVE | Match the string with case sensitivity (default) |
Twine\Config\In::CASE_INSENSITIVE | Match the string with case insensitivity |
$string = new Twine\Str('pink');
$string->in('john pinkerton'); // Returns true
$string = new Twine\Str('purple');
$string->in('john pinkerton'); // Returns false
$string = new Twine\Str('Pink');
$string->in('john pinkerton', Twine\Config\In::CASE_INSENSITIVE); // Returns true
$color = new Twine\Str('pink');
$name = new Twine\Str('john pinkerton');
$color->in($name); // Returns true