JAVA中文本框内只能输入1024到65535之间的数字的正则表达式怎么写
来源:百度知道 编辑:UC知道 时间:2024/06/18 13:09:09
只考正则表达式很难做到,要把正则表达式和数值判断结合起来使用:
static boolean check(String s) {
if(s.matches("\\d{4,5}")) {
int n = Integer.parseInt(s);
if(n>=1024 && n<=65535) return true;
}
return false;
}
正解