All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ajaxjs.framework.Vaildtor Maven / Gradle / Ivy

Go to download

AJAXJS aims to full-stack, not only the server-side framework, but also integrates the front-end library. It'€™s written in HTML5 + Java, a successor to the JVM platform, efficient, secure, stable, cross-platform and many other advantages, but it abandoned the traditional enterprise architecture brought about by the large and bloated, emphasizing the lightweight, and fast, very suitable for the Internet fast application.

The newest version!
package com.ajaxjs.framework;

public class Vaildtor {
    /**
     * 验证 email 是否合法正确
     */
    private final static String EMAIL_REGEXP = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    /**
     * 是否合法的邮件
     *
     * @param email 待测试的邮件地址
     * @return true 表示为合法邮件
     */
    public static boolean isVaildEmail(String email) {
        return email.matches(EMAIL_REGEXP);
    }

    /**
     * 验证手机号码是否合法正确
     */
    private static final String PHONE_REGEXP = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$";

    /**
     * 是否合法的手机号码,仅限中国大陆号码
     *
     * @param phoneNo 待测试的手机号码
     * @return true 表示为手机号码
     */
    public static boolean isVaildPhone(String phoneNo) {
        return phoneNo.matches(PHONE_REGEXP);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy