Clean string in String.swiftyTime() using [a-zA-Z] regex

This commit is contained in:
Caleb Kleveter 2018-05-29 08:59:52 -05:00
parent 623f6f733d
commit 8370d59f65
No known key found for this signature in database
GPG Key ID: B38DBD5CF2C98D69
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ extension String {
var second: Double = 0 var second: Double = 0
var offset: Double = 0 var offset: Double = 0
var cleanedTime = replacingOccurrences(of: "am", with: "").replacingOccurrences(of: "pm", with: "").replacingOccurrences(of: " ", with: "").replacingOccurrences(of: "Z", with: "") var cleanedTime = self.replacingOccurrences(of: "[a-zA-Z]", with: "", options: .regularExpression)
let sep: Character = self.contains(".") && !self.contains(":") ? "." : ":" let sep: Character = self.contains(".") && !self.contains(":") ? "." : ":"
if (self.contains("-") || self.contains("+")) { if (self.contains("-") || self.contains("+")) {