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

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?