I need a method that can tell me if a String has non alphanumeric characters.
For example if the String is \"abcdef?\" or \"abcdefà\", the method must return true.
Though it won't work for numbers, you can check if the lowercase and uppercase values are same or not, For non-alphabetic characters they will be same, You should check for number before this for better usability
If you can use the Apache Commons library, then Commons-Lang StringUtils
has a method called isAlphanumeric()
that does what you're looking for.