Created
November 25, 2014 10:50
-
-
Save yat1ma30/46e1e300c01a771933c7 to your computer and use it in GitHub Desktop.
UITextFieldでemailのvalidate ref: http://qiita.com/ottati/items/b43584537d0c8c54062d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// その文字列がメールアドレスかどうか調べる | |
class func isValidEmail(string: String) -> Bool { | |
println("validate calendar: \(string)") | |
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}" | |
var emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) | |
let result = emailTest?.evaluateWithObject(string) | |
return result! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment