Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Banned word filter? 1

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
Hi,

I am trying to disallow banned words in an input string. The trouble is that my function will catch the banned word only if it is the only thing entered. It will allow it if other characters are present in the string.

For example, if the banned word is FACK:

FACK as input is disallowed;
FACKOFF as input is being allowed (which I do not want, since it contains FACK)

Here is where I am at with the function:

Code:
var contains:Function = function(input,arrayData){
	for(var j:Number=0;j<arrayData.length;j++){
		if(arrayData[j]==input){
			return 1;
		}
	}
	return 0;
}

Thanks.

frozenpeas
--
Micfo.com Affiliate Program
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top