Package com.kong.util;
Import java.util.StringTokenizer;
/ ** * Used to check if the input Email address meets the specification *
title: p> * *
Description: p> * *
Copyright: CopyRight (C) 2004 P > * *
Company: konggo p> * * @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;}}