all groups > flash actionscript > july 2006 >
You're in the

flash actionscript

group:

Quick Question, should be easy to answer


Quick Question, should be easy to answer gregmax17
7/8/2006 6:00:32 PM
flash actionscript:
How do you strip special characters from a text in Flash? For example, the
viewer enters this in the Input Text field:

strin/tg<!--fun-->

How do I get rid of the / < > ! - ? I would like to know because I don't want
a viewer to enter bad characters in a database. Any help would be great, thanks.
Re: Quick Question, should be easy to answer kglad
7/9/2006 1:47:45 AM
create an array of undesirable characters and use the split() method of strings
and join() method of arrays to strip those characters:



badCharacterA=["/","<",">","!","-","?"];
strippedString=inputTF.text;
for(var i=0;i<badCharacterA.length;i++){
strippedString=strippedString.split(badCharacterA[i]).join("");
}
AddThis Social Bookmark Button