Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blank string in Swift
extension String {
var isBlank: Bool {
get {
let trimmed = stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
return trimmed.isEmpty
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment