Answers for "check if str contains a word puytho"

PHP
2

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
3

how to check if a string contains a word python

if word in mystring: 
   print('success')
Posted by: Guest on December-18-2020

Code answers related to "check if str contains a word puytho"

Browse Popular Code Answers by Language