📄 teststring2.java
字号:
public class TestString2 {
private String str;
private int dig;
private int low;
private int up;
private int others;
public TestString2(String st)
{
str=st;
String s;
s=str.replaceAll("[^0-9]", "");
dig=s.length();
s=str.replaceAll("[^a-z]","");
low=s.length();
s=str.replaceAll("[^A-Z]","");
up=s.length();
others=str.length()-dig-low-up;
}
public String getStr() {
return str;
}
public int getDig() {
return dig;
}
public int getLow() {
return low;
}
public int getUp() {
return up;
}
public int getOthers() {
return others;
}
public static void main(String[] args) {
TestString2 s=new TestString2("r78@#F.?fewf. fe3fw0f");
System.out.println("字符串:"+s.getStr());
System.out.println("有数字:"+s.getDig());
System.out.println("有小写字母:"+s.getLow());
System.out.println("有大写字母:"+s.getUp());
System.out.println("其他类型:"+s.getOthers());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -