This commit is contained in:
Arkadiusz Fal
2023-05-27 01:01:17 +02:00
parent 80a644eb7a
commit 3adbea1897
3 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
import Foundation
extension String {
var replacingHTMLEntities: String {
do {
return try NSAttributedString(data: Data(utf8), options: [
.documentType: NSAttributedString.DocumentType.html,
.characterEncoding: String.Encoding.utf8.rawValue
], documentAttributes: nil).string
} catch {
return self
}
}
}