Skip to main content

Android JAVA String Validation



i have a question :





I want to create an app that take a String from user input. This String will be in an email format. So there's some requirement's :





  1. .(full stop) can't be placed before @



  2. .(full stop) and @ can't be more than one



  3. .(full stop) and @ can't be side by side







Note : This is NOT a school homework(i just felt that this is like a homework after i typed it), i just want to learn more about String :D





I already did some research's but i still can't solve those problem's :D





Thanks all, and sory if i made some mistake's, English is not my native languange :D


Comments

  1. This is Universal Email Validation For Email

    if(eMailValidation(YourEmailString)){
    /// right Email-id
    }
    public boolean eMailValidation(String emailstring) {
    Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+");
    Matcher emailMatcher = emailPattern.matcher(emailstring);
    return emailMatcher.matches();
    }

    ReplyDelete

Post a Comment

Popular posts from this blog

Wildcards in a hosts file

I want to setup my local development machine so that any requests for *.local are redirected to localhost . The idea is that as I develop multiple sites, I can just add vhosts to Apache called site1.local , site2.local etc, and have them all resolve to localhost , while Apache serves a different site accordingly.