Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static boolean isMail(String str) {
        if (isEmpty(str))
            return false;
        String mailRegex = "^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$";
        Boolean b = str.matches(mailRegex);
        return b;
    }

    public static boolean isEmpty(String str) {
        if (str == null)
            return true;
        str = str.trim();
        if (str.length() == 0)
            return true;
        return false;
    }
}