Considering that index of will match all possible situations, I prefer to split the string into an array using an empty space as the delimiter, than loop over the results to check for an exact match.
The performance of this can be very good or very bad depending on the amount of text you have to look into. !k -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Patricia Britt Sent: Tuesday, September 12, 2006 12:10 PM To: [email protected] Subject: [Flashcoders] does actionscript have something like sql's IN orLIKE ? hello all, i have been lurking for about a month and I must say I am extremely impressed and sometimes overwhelmed by the vast amount of knowledge on this list. I have been searching for about a week for a simple solution to search within a string for one word or two words. I am working on a quiz with several fill in the blanks and I am sure my users will have a wide assortment of correct answers but I am looking to see if they for example input either "cover" or "time" in any of the text input boxes. Stuff I have tried so far substr - problem because i am checking for either I have resorted to the below this.opened_btn.onRelease=function(){ myVar=open1.substr(0,4).toUpperCase(); myVar2=open2.substr(0,4).toUpperCase(); if ((myVar=="TIME"||myVar=="COVE"||myVar=="DATE")&&(myVar2=="TIME"||myVar2=="CO VE"||myVar2=="DATE")) { gotoAndStop("quizend"); } else { gotoAndStop("quizend"); } } I have also tried indexOf but I don't think I understood it because it would pull any of the letters and make it a true condition(I left my comments in this one so you could see what I don't understand) this.opened_btn.onRelease=function(){ // toUpperCase() coverts the text instance to upper case myVar=open1.toUpperCase(); myVar2=open2.toUpperCase(); //indexOF allows you to pull from the string and -1 allows the word to be pulled from //within anywhere in the string if you used 0 that would mean the string would have //to start with whatever is enclosed in the parenthesis if ((myVar.indexOf("TIME")==-1||myVar.indexOf("COVER")==-1||myVar.indexOf("DATE ")==-1)&&(myVar2.indexOf("TIME")==-1||myVar2.indexOf("COVER")==-1||myVar2.in dexOf("DATE")==-1)) { trace(myVar); trace(myVar2); trace("success"); gotoAndStop("quizend"); } else { gotoAndStop("quizend"); trace("failure"); } } any help would be greatly appreciated. I have an assortment of fill in the blanks and some of them are phrases and I would like to allow for some user differences. Sincerely, Patricia Britt --------------------------------- Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business. _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

