Created
April 29, 2022 11:29
-
-
Save vladimir-anisimov/028d3109a5f1cdfd56c07b63916658cf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
extension String { | |
var isBlank: Bool { | |
return self.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty | |
} | |
func replace(string:String, replacement:String) -> String { | |
return self.replacingOccurrences(of: string, with: replacement, options: NSString.CompareOptions.literal, range: nil) | |
} | |
func removeWhitespace() -> String { | |
return self.replace(string: " ", replacement: "") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment