Answers for "how to check if string contains"

PHP
5

How do I check if a string contains a specific word?

$a = 'Hello world?';

if (strpos($a, 'Hello') !== false) { //PAY ATTENTION TO !==, not !=
    echo 'true';
}
if (stripos($a, 'HELLO') !== false) { //Case insensitive
    echo 'true';
}
Posted by: Guest on May-18-2020
0

how to use the if sentence in the string

public boolean contains(CharSequence str)
Posted by: Guest on July-24-2020

Code answers related to "how to check if string contains"

Browse Popular Code Answers by Language