Open
Description
I want to change the validate(value:String) method in RequiredRule.swift class.
It should first trim all whitespaces then should check for isEmpty.
For this I want to create a String class extension like this:
extension String
{
func trim()->String
{
return self.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet());
}
}
and then change the validate method like this:
public func validate(value: String) -> Bool { return !(value.trim().isEmpty) }
Suggest me how to do this.
Metadata
Metadata
Assignees
Labels
No labels