in iPhone, OSX

iOS/OSX – validate phone number

I need to check whether i can use the phone number or not in iOS/OSX.
This is what i found solution at the stack over flow.

NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
BOOL phoneValidates = [phoneTest evaluateWithObject:phoneNumber];
NSString *phoneRegex = @"^((\\+)|(00))[0-9]{6,14}$";

thanks.

Write a Comment

Comment