Checking for special characters

0

I need to do a check on a string in java that allows the user to enter normal accents, but do not enter special characters such as @#!$! etc.

I did something similar to verify numeric and blank registration using 'matches'. Is there something similar for such a problem?

    
asked by anonymous 04.11.2016 / 12:58

1 answer

1

I do not know how you plan to implement it, but I'll show you two ways.

If you want to check character by character while typing, you can use Character.isLetterOrDigit(char) .

Another way would be to let the user type the String complete and then check later using StringUtils.isAlphanumeric(String)

    
04.11.2016 / 13:11