1.导入hutool的maven依赖
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
2.复制一下代码执行
import cn.hutool.core.lang.Validator;
public class Test {
public static void main(String[] args) throws Exception{
String word1 = "abcDEFG";
String word2 = "12abc";
if (Validator.isWord(word1)) {
System.out.println(word1+"字符串全是字母");
}else {
System.out.println(word1+"字符串不全是字母");
}
if (Validator.isWord(word2)) {
System.out.println(word2+"字符串全是字母");
}else {
System.out.println(word2+"字符串不全是字母");
}
}
}