mohammad-i
12/14/2017 - 12:22 AM

Alphabet and space only

Helpful for name validation

/// Return if input contains alphabet and space only. Having space in front and end of string also fails.
	///
	/// - Parameter input: input string
	/// - Returns: returns true if input contains only alphabet else return false
	static func isAlphaSpace(_ input: String) -> Bool{
		return !input.isEmpty && input.range(of: "^[a-zA-Z]+(?: [a-zA-Z]+)*$", options: .regularExpression) != nil
	}