frozenpeas
Technical User
Hello,
I am trying to limit a string to only alphanumeric characters. The trouble is that it will allow illegal characters as long as legal characters are also in the string.
"THIRTY" is allowed;
"30" is allowed;
"+" is not allowed;
"30+" is allowed but should not be allowed;
Here is the state of my function:
Thanks everyone.
frozenpeas
--
Micfo.com Affiliate Program
I am trying to limit a string to only alphanumeric characters. The trouble is that it will allow illegal characters as long as legal characters are also in the string.
"THIRTY" is allowed;
"30" is allowed;
"+" is not allowed;
"30+" is allowed but should not be allowed;
Here is the state of my function:
Code:
var checkChars:Function = function(input){
var i:Number = 0;
while(i<txtinput.length && (" abcdefghijklmnopqrstuvwxyz0123456789").indexOf(input.charAt(i)) != -1){
goodString = true;
i++;
}
if(goodString==true){
return 1;
}else{
return -1;
errFlag = true;
}
}
Thanks everyone.
frozenpeas
--
Micfo.com Affiliate Program