Musixmatch Invalid Token Alert, better token input, Overwrite Configuration Option

This commit is contained in:
eevee committed 2024-06-05 01:17:16 +03:00
1 parent e258ebc35b
commit 3c5509ea53
12 files changed
+145 -48

No files matched your search

@@ -44,4 +44,19 @@ extension String {
withTemplate: ""
)
}
var hexadecimal: Data? {
var data = Data(capacity: count / 2)
let regex = try! NSRegularExpression(pattern: "[0-9a-f]{1,2}", options: .caseInsensitive)
regex.enumerateMatches(in: self, range: NSRange(startIndex..., in: self)) { match, _, _ in
let byteString = (self as NSString).substring(with: match!.range)
let num = UInt8(byteString, radix: 16)!
data.append(num)
}
guard data.count > 0 else { return nil }
return data
}
}