Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yat1ma30
Created November 25, 2014 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yat1ma30/46e1e300c01a771933c7 to your computer and use it in GitHub Desktop.
Save yat1ma30/46e1e300c01a771933c7 to your computer and use it in GitHub Desktop.
UITextFieldでemailのvalidate ref: http://qiita.com/ottati/items/b43584537d0c8c54062d
/// その文字列がメールアドレスかどうか調べる
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