<span style="font-size:18px;"> String a="注册成功!";
boolean b=false;
String[] splitphone=new String [3];
splitphone=dian.split("-",2);
if(shen.length()!=16&&shen.length()!=18){
System.out.println("身份证号必须是16位或是18位!");
}else if(shou.length()!=11){
System.out.println("手机号码必须是11位!");
}else if(splitphone[0].length()!=4&&splitphone[0].length()!=7){
System.out.println("座机号码区号必须是四位,电话号码必须是七位!");
}else{
b=true;
}
return a;
******************/*/*/*/*/
Scanner input =new Scanner (System.in);
hui h=new hui();
String a,b1,b2;
String w;
System.out.println("***欢迎进入注册系统***");
do{
System.out.println("请输入身份证号:");
a=input.next();
System.out.println("请输入手机号:");
b1=input.next();
System.out.println("请输入座机号:");
b2=input.next();
w=h.zhuce(a,b1,b2);
System.out.println(w);
}while(!w.equals("注册成功!"));
}</span>
Java 实现会员注册升级 关键代码
最新推荐文章于 2022-11-06 16:20:50 发布
这段Java代码实现了会员注册时的身份证、手机号和座机号验证。如果输入的身份证不是16位或18位,手机号不是11位,或者座机号码区号不是4位、电话号码不是7位,程序会输出错误提示。当所有验证通过后,返回'注册成功!'。
摘要由CSDN通过智能技术生成