Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to check if a string contains only alphabets and numbers in java

string.matches("[a-zA-Z]*"); // return true if it has only letters 
string.matches("[0-9]*"); // return true if it has only numbers 
string.matches("[a-zA-Z0-9]*"); // return true if it has only letters and numbers
 
PREVIOUS NEXT
Tagged: #check #string #alphabets #numbers #java
ADD COMMENT
Topic
Name
9+7 =