//是否是email public static boolean isMail(String mails) { String regEx = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";// "\\p{Alpha}\\w{2,15}[@][a-z0-9]{3,}[.]\\p{Lower}{2,}"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(mails); if (m.find()) { return true; } return false; } //检查密码必须数字字母组合 public static boolean checkpwd(String pwd) { String regEx = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,10}$"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(pwd); if (m.find()) { return true; } return false; } //检查是否是手机号码 public static boolean isMobileNO(String mobiles) { if (mobiles.length() == 11) { String regEx = "^0?(13[0-9]|15[012356789]|17[0678]|18[0-9]|14[57])[0-9]{8}$"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(mobiles); if (m.find()) { return true; } } return false;}
/** * 检查用户输入密码 */ public static boolean checkedPwd(EditText edittext, Button btn, TextView msgtext) { if (!edittext.getText().toString().trim().equals("")) { msgtext.setText(""); if (edittext.getText().toString().trim().length() >= 6) { msgtext.setText(""); btn.setClickable(true); btn.setBackgroundResource(R.color.main_color); return true; } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("密码不足6位"); return false; } } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("密码不能为空"); return false; } } //检查用户输入手机 public static boolean checkphone(EditText edittext, Button btn, Button codebtn, TextView msgtext, int codetime) { if (Util.isMobileNO(edittext.getText().toString())) { msgtext.setText(""); if (codetime == 40) { codebtn.setClickable(true); codebtn.setBackgroundResource(R.color.main_color); } return true; } else { codebtn.setClickable(false); msgtext.setText("手机号码格式不正确"); btn.setClickable(false); return false; } }//检查二次输入密码 public static boolean checkednewpwd(EditText oldedittext, EditText newedittext, Button btn, TextView msgtext) { if (newedittext.getText().toString().length() >= 6) { if (newedittext.getText().toString().trim().equals(oldedittext.getText().toString().trim())) { msgtext.setText(""); btn.setClickable(true); btn.setBackgroundResource(R.color.main_color); return true; } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("两次输入密码不一致"); return false; } } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("二次输入密码少于6位"); return false; } } //检查验证码 public static boolean checkvercodr(EditText edittext, Button btn, TextView msgtext) { if (!edittext.getText().toString().equals("")) { if (edittext.getText().toString().length() == 6) { msgtext.setText(""); return true; } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("验证码不足6位"); return false; } } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("验证码不能为空"); return false; } }//检查用户名 public static boolean checkuser(EditText edittext, Button btn, TextView msgtext) { if (!edittext.getText().toString().equals("")) { msgtext.setText(""); if (edittext.getText().toString().length() >= 2) { if (Util.isNickName(edittext.getText().toString().trim())) { msgtext.setText(""); return true; } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("昵称必须为中文或数字或英文"); return false; } } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("昵称小于2位"); return false; } } else { btn.setClickable(false); btn.setBackgroundResource(R.drawable.btn_gray); msgtext.setText("昵称不能为空"); return false; } }啦啦啦啦啦啦啦啦啦啦 德玛西亚! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
登录,注册检查账号,密码,Email,是不是手机号什么的
最新推荐文章于 2020-07-12 12:00:58 发布