Parsing an array of string commands, I need to know if a string contains a specific keyword.
Sounds simple I know, but the problem comes when the command keyword may also be part of another word.
Ex:
CHECKSOUND
SOUND
CHECK
So I need to check if the current line has the CHECKSOUND, SOUND, or CHECK command.
If I use something like:
if(stristr($line,'SOUND') == true)
Then it may find CHECKSOUND
before SOUND
and thus not parse correctly.
Question:
Is there a way to find only an occurrence of a whole word like SOUND and ignore the occurrence SOUND if found as part of another word like CHECKSOUND?
I am sure I am missing something simple here.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…