Using Apache Commons Lang:

!StringUtils.isAlphanumeric(String)

Alternativly iterate over String's characters and check with:

!Character.isLetterOrDigit(char)

You've still one problem left: Your example string "abcdefà" is alphanumeric, since à is a letter. But I think you want it to be considered non-alphanumeric, right?!

So you may want to use regular expression instead:

String s = "abcdefà";
Pattern p = Pattern.compile("[^a-zA-Z0-9]");
boolean hasSpecialChar = p.matcher(s).find();
Answer from Fabian Barney on Stack Overflow
🌐
codippa
codippa.com › home › check for non-alphanumeric characters in a string in java
Check for non-alphanumeric characters in a string in java - codippa
January 11, 2025 - Regular expression ^.*[^a-zA-Z0-9].*$ tests for any character other than a-z, A-Z and 0-9. Thus if it finds any character other than these, it returns true(means non-alphanumeric character).
Discussions

java - Check if String contains only letters - Stack Overflow
The idea is to have a String read and to verify that it does not contain any numeric characters. So, something like "smith23" would not be acceptable. More on stackoverflow.com
🌐 stackoverflow.com
Java- How to find non-alphabetical letters in a string? (Quick way) - Stack Overflow
In Java, given a string, like "abc@df" where the character '@' could be ANY other non-letter, like '%', '^', '&', etc. What would be the most efficient way to find that index? I know that a fo... More on stackoverflow.com
🌐 stackoverflow.com
Is there any easy way to check if a string contains non-alphabet character?
Find answers to Is there any easy way to check if a string contains non-alphabet character? from the expert community at Experts Exchange More on experts-exchange.com
🌐 experts-exchange.com
June 8, 2007
How do I check if a string contains a letter?
input.chars().allMatch(Character::isDigit); Will check if the input only contains digits. So you can invert this using ! to check if it contains some non digit character. More on reddit.com
🌐 r/learnjava
5
1
March 22, 2024
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java
String Contains Non-Alphanumeric Characters in Java - Java Code Geeks
July 14, 2023 - A more concise and efficient way to solve this problem is by using regular expressions. We can define a regular expression pattern that matches any non-alphanumeric character and then use the Pattern and Matcher classes from the java.util.regex ...
🌐
Baeldung
baeldung.com › home › java › java string › check if a string contains non-alphanumeric characters
Check if a String Contains Non-Alphanumeric Characters | Baeldung
January 8, 2024 - This functionality is crucial in various scenarios such as finding the strength of a password, rejecting special characters entered in an application, and many more. The requirement becomes even more interesting when we want to restrict its usage to a language script, which we have also tried to address here. We think using regular expression is the most flexible way of implementing this requirement. Let’s consider a simple use case, where the application must accept only English digits and alphabet characters.
🌐
GeeksforGeeks
geeksforgeeks.org › java › check-if-a-string-contains-only-alphabets-in-java
Check if a String Contains only Alphabets in Java - GeeksforGeeks
July 15, 2025 - // Java program to check if a string // contains only alphabets Using ASCII range public class CheckAlphabets { public static boolean isAlphabetic(String s) { // Return false if the string is // null or empty if (s == null || s.isEmpty()) { return false; } // Iterate through each character in the string for (char c : s.toCharArray()) { // Check if the character is not a letter // (between A-Z or a-z in ASCII range) if (!(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z')) { // Return false if any non-alphabet character is found return false; } } return true; // Return true if all characters are
🌐
Programiz
programiz.com › java-programming › examples › alphabet
Java Program to Check Whether a Character is Alphabet or Not
public class Alphabet { public static void main(String[] args) { char c = '*'; if( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) System.out.println(c + " is an alphabet."); else System.out.println(c + " is not an alphabet."); } } ... In Java, the char variable stores the ASCII value of a character (number between 0 and 127) rather than the character itself.
Find elsewhere
🌐
Experts Exchange
experts-exchange.com › questions › 22621127 › Is-there-any-easy-way-to-check-if-a-string-contains-non-alphabet-character.html
Solved: Is there any easy way to check if a string contains non-alphabet character? | Experts Exchange
June 8, 2007 - I use the following RegEx to check if a string contains alphabet chars and the '.': myString.matches("[A-Za-z\ \.]+"); But if failed. How can I deal with the '.'? ... \.]+") will return a true or a false depending on whether it matches or not. You can use that boolean value to decide what you want to do.. C:\>type Test.java import java.text.*; public class Test { public static void main(String []o){ String s = o[0]; System.out.println(s.match
🌐
Reddit
reddit.com › r/learnjava › how do i check if a string contains a letter?
How do I check if a string contains a letter? : r/learnjava
March 22, 2024 - List<String> errors = new ArrayList<>(); for(int i = 0; i < s.length(); ++i) { int codepoint = s.codePointAt(i); if(Character.isAlphabetic(codepoint)) { errors.add(String.format("Codepoint %d at index %d is alphabetic, not a digit", codepoint, i)); continue; } if(Character.isSpaceChar(codepoint)) { errors.add(String.format("Codepoint %d at index %d is a space character, not a digit", codepoint, i)); continue; } if(!Character.isDigit(codepoint)) { errors.add(String.format("Codepoint %d at index %d is not a digit", codepoint, i)); continue; } } return errors; }
🌐
Vultr Docs
docs.vultr.com › java › examples › check-whether-a-character-is-alphabet-or-not
Java Program to Check Whether a Character is Alphabet or Not | Vultr Docs
December 3, 2024 - Java offers multiple ways to determine if a specific character is part of the alphabet. This ability is crucial for input validation, parsing, and various text-processing applications where character identification plays a key role.
🌐
CodingTechRoom
codingtechroom.com › question › how-to-check-for-non-alphanumeric-characters-in-a-string-using-java
How to Check for Non-Alphanumeric Characters in a String - CodingTechRoom
Use regular expressions to match non-alphanumeric characters. Iterate through each character to check if it is alphanumeric using built-in methods. Leverage language-specific functions that can detect such characters.
🌐
Baeldung
baeldung.com › home › java › java array › removing all non-alphabetic characters from string array in java
Removing All Non-alphabetic Characters From String Array in Java | Baeldung
November 18, 2024 - We use the replacePatttern() method of Apache Commons Lang, which expects the input string, the regex pattern to look for, and the String to replace it with where we find the pattern.
🌐
javathinking
javathinking.com › blog › character-isalphabetic-vs-character-isletter
Character#isAlphabetic vs. Character#isLetter: A Deep Dive into Java Unicode Character Checks — javathinking.com
You’re processing multilingual text with non-standard alphabetic characters (ancient scripts, historical text). You need to include letter numbers like Roman numerals as valid alphabetic characters. You’re working with text that uses combining marks explicitly marked as alphabetic by Unicode. Character.isLetter() and Character.isAlphabetic() serve distinct purposes rooted in Unicode category definitions. isLetter() is a strict check for standard letters, while isAlphabetic() offers a broader check for all characters considered alphabetic by the Unicode Standard.
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-remove-all-non-alphanumeric-characters-from-a-string-in-java
How to remove all non-alphanumeric characters from a string in Java - GeeksforGeeks
July 15, 2025 - Hence traverse the string character by character and fetch the ASCII value of each character. If the ASCII value is not in the above three ranges, then the character is a non-alphanumeric character.
🌐
Medium
medium.com › @saraswathirajkumar18 › java-program-to-check-if-a-string-contains-only-alphabets-90b20cc1c78f
Java Program to Check if a String Contains Only Alphabets. | by Saraswathi Rajkumar | Medium
April 10, 2024 - import java.util.regex.Pattern; public class CheckStringisAlphabet { //1.using if condition check each char with [a-z]&[A-Z] //2.using isLetter() //3.using regular expression public static void checkString(String str) { //create variable res-to store result status boolean res=true; //check string is null or empty string so string contains no char if(str==null||str.equals("")) { //set res as false res=false; } else { //using loop retrieve each char in string for(int i=0;i<str.length();i++) { //create variable c-to store each char char c=str.charAt(i); //if char not in a-z or A-Z,then string not