Powered By Blogger

Tuesday, June 5, 2012

How to check valid email address in iPhone SDK?

Using the below function , you can check email address format validity. Hope , this will help you.
 
+(BOOL)checkEmailAddress:(NSString *)strEmail
{
    NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}";  
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];  
    return [emailTest evaluateWithObject:strEmail];
}


If any one has query then place you it over here.

Thanks and Regards,
Nilesh Prajapati
 

No comments:

Post a Comment