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
const dayOffset = (day, offset) => { | |
var days = ["Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]; | |
return days[(days.indexOf(day) + offset) % 7]; | |
} |
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
import Foundation | |
extension String { | |
func isValidEmailAddress() -> Bool | |
{ | |
let emailPattern = ".+@.+\\..+" | |
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailPattern) | |
let isValid = emailTest.evaluateWithObject(self) | |
return isValid | |
} |