我试图找出字符串是否只有数字和特殊字符。
我试过下面的代码,但它不工作
String text="123$%$443";
String regex = "[0-9]+";
String splChrs = "-/@#$%^&_+=()" ;
if ((text.matches(regex)) && (text.matches("[" + splChrs + "]+"))) {
System.out.println("no alphabets");
}
慕慕森
LEATH
慕森王
明月笑刀无情
忽然笑
随时随地看视频慕课网APP
相关分类