⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emailutils.java

📁 简单的流言板系统,用myeclipse进行编写的,采用简单的jstl+javabean+servlet+jsp,属于三层架构.
💻 JAVA
字号:
package me.work.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class EmailUtils {

	private EmailUtils() {

	}

	/**
	 * regular expression
	 */
	private static final String CHECK = "\\w+([-+.]\\w+)*@\\w+([-]\\w+)*\\.\\w+([-]\\w+)*";

	
	/**
	 * 
	 * test if a string is a email format
	 * 
	 * @param email
	 *            string to test
	 * @return true is,false is not
	 */
	public static boolean isEmail(String email) {
		// get a pattern object with specific pattern
		Pattern p = Pattern.compile(CHECK);
		// get a matcher object
		Matcher m = p.matcher(email);
		// do the test
		if (m.matches()) {
			// test if the length of the string is over 30
			if (email.length() <= 30) {
				// if not return ture
				return true;
			}
		}
		return false;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -