I am doing a street Address validation, in stret address validation text field should allow all the characters and Special characters.
To allow all the special characters, I have used the following way. Is there a better way to allow all the special characters?
function isAcceptedChar_StAddress(s)
{
if (s == ',' || s == '#' || s == '-' || s == '/' || s == " " ||
s == '!' || s == '@' || s == '$' || s == "%" || s == '^' ||
s == '*' || s == '(' || s == ")" || s == "{" || s == '}' ||
s == '|' || s == '[' || s == "]" || s == "\\")
{
return true;
}
else
{
return false;
}
}
In the above code, i am comparing each character if it is matching I am returning true, else return false