Judgment Email

xiaoxiao2021-03-06  40

Package com.kong.util;

Import java.util.StringTokenizer;

/ ** * Used to check if the input Email address meets the specification *

title: * *

Description: * *

Copyright: CopyRight (C) 2004 * *

Company: konggo * * @Author kong * @version 1.0 * / public class checkemail {public checkemail () {} / ** * Check Email Address * @Param Emailstr String To check Email Address * @Return Boolean Returns the correct email address specification, vice verse * / public boolean check (string emailstr) {int count = 0; string [] partstr = {","}; // with '@ 'Symbol String Email String Strings StringTokenizer St1 = New StringTokenizer (Emailstr, "@"); if (st1.countToKens ()> 2) Return false; // Judging whether there is more than one' @ 'symbol while (ST1. HasmoreToKens () {partStr [count] = st1.nextToken (); count = count 1;} // Take the string section of the symbol '@' back string StringTokenizer ST2 = New StringTokenizer (PartStr] 1], "."); String lastpart = ""; while (st2.hasmoretokens ()) {lastpart = st2.nextToken ();} if (lastpart.length ()> 3 || lastpart.length () <2 Return False; Return True;}}

转载请注明原文地址:https://www.9cbs.com/read-68159.html

New Post(0)