If you don't want it to consider the match found when uppercase doesn't
match lowercase:
booFound = Boolean(strSentence.indexOf(strSearch)+1);
If you want "larry" to be considered equivalent to "Larry":
booFound =
Boolean(strSentence.toLowerCase().indexOf(strSearch.toLowerCase())+1);
Application of the latter, which will show you the result:
strSearch = "larry";
strSentence = "My name is Larry James";
booFound =
Boolean(strSentence.toLowerCase().indexOf(strSearch.toLowerCase())+1);
trace("strSearch: "+strSearch+" | booFound: "+booFound);
--
"There are 10 kinds of people in the world. Those who understand binary
numbers and those who don't."
----------------------
Byron "Barn" Canfield
http://www.headsprout.com Flash examples:
http://www.byronc.com/flash5 [I do not respond to private emails regarding issues for which the
appropriate venue is this newsgroup, nor do I reply to posts by email.]
[quoted text, click to view] "Baba" <someone@somewhere.com> wrote in message
news:bgcu15$sf6$1@forums.macromedia.com...
> Hi to all:
>
> How can I detect a string contains a certain string.
>
> I want my user to input a sentence and as long as this sentence contains a
> certain word(s) I am looking for, that the user is allow to move to some
> frames.
>
> for example:
>
> If the user entered "My name is Larry James".
>
> And the word I am looking for is Larry, is there a function to scan
through
> the whole sentence and detect the presence of Larry?
>
> sample code would be appreciated.
>
> thanks
>
> Baba.
>
>