Wednesday, February 29, 2012

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

1 comment:

  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