---
title: "Android手机、E-mail、QQ验证 "
author: "Jacular"
date: "2012-08-12T19:36:26Z"
tags: []
categories: ["移动开发"]
slug: "android-e-mail-qq"
draft: false
lastmod: "2012-08-07T23:19:53Z"
id: 1624640
url: "https://jacular.iteye.com/blog/1624640"
---

/**
 
     * 验证字符串是否是email
 
     * @param str
 
     * @return
 
     */
 
    public static boolean isEmail(String str) {
 
Pattern pattern = Pattern.compile("+@(+//.)++",Pattern.CASE_INSENSITIVE); 
 
Matcher matcher = pattern.matcher(str); 
 
if (matcher.matches()) {
 
return true;
 
}else {
 
return false;
 
} 
 
}    
 
 
 
    /**
 
     * 验证是否是手机号码
 
     * @param str
 
     * @return
 
     */
 
    public static boolean isCellphone(String str) {
 
Pattern pattern = Pattern.compile("1{10}");
 
Matcher matcher = pattern.matcher(str); 
 
if (matcher.matches()) {
 
return true;
 
}else {
 
return false;
 
} 
 
}
 
 
 
    /**
 
     * 验证是否是QQ号码
 
     * @param str
 
     * @return
 
     */
 
    public static boolean isQQ(String str) {
 
Pattern pattern = Pattern.compile("{5,10}");
 
Matcher matcher = pattern.matcher(str); 
 
if (matcher.matches()) {
 
return true;
 
}else {
 
return false;
 
} 
 
}