邮箱的验证

// 验证邮箱的格式 emailtypewrong(邮箱格式不正确)
 public static boolean isEmail(String stremail) {
  String strPattern = "^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\."
    + "[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
  Pattern p = Pattern.compile(strPattern);
  Matcher m = p.matcher(stremail);
  return m.matches();
 }
 // repassworddifferent 您输入的密码前后不相同
 public static boolean isRepassword(String strrepassword) {
  if (strrepassword.equals(isRepassword(null))) {
   UiHandler.toast(R.string.repassworddifferent, Toast.LENGTH_SHORT);
  }
  return false;
 }
看起来麻烦用起来容易啊!!! 
posted @ 2012-12-27 10:41  枕头君  阅读(166)  评论(0编辑  收藏  举报