Email Validation

6 02 2008

Here is a base email validation class for AS2

function validateEmail(emailStr:String) {
var errorCount:Number = 0;
//check to see if there are at least two chars be for the @ symbol
if (emailStr.indexOf(“@”)<2) {
errorCount++;
}
//check that the @ is not within 2 chars of .
if (emailStr.lastIndexOf(“.”)<=(emailStr.lastIndexOf(“@”)+2)) {
errorCount++;
}
//check length eg min aa@bb.cc
if (emailStr.length<8) {
errorCount++;
}
//check there is only one @
if (emailStr.indexOf(“@”) != emailStr.lastIndexOf(“@”)) {
errorCount++;
}
// return a T/F to the flash file
if (errorCount == 0) {
return true;
} else {
return false;
}
}

//to use it
if(validateEmail(email.text)){
trace(“EMAIL VALID”);
}else{
trace(“EMAIL NOT VALID”)
}

Advertisements




A Sweet idea to help out guys with Valentine’s Day.

4 02 2008

Haha if you cant find anything for your girl friend try this.

This is meant to be a secret, or at least a secret for guys only. A retailer in New Zealand is pulling a Valentine’s Day Stunt that all guys can get in on.

I thought it was kinda a sweet idea.

read more | digg story





New! Get FREE breakthrough broadband with Google TiSP (BETA).

1 04 2007

http://www.google.com/tisp/

P.S Check todays date