📄 emailutils.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 + -