- Remove stripHTMLSimple regex-based HTML stripping method - Keep stripHTML with NSAttributedString-based implementation (used in codebase) - Method was not used anywhere in the project
18 lines
498 B
Swift
18 lines
498 B
Swift
import Foundation
|
|
|
|
extension String {
|
|
var stripHTML: String {
|
|
// Entfernt HTML-Tags und decodiert HTML-Entities
|
|
let attributedString = try? NSAttributedString(
|
|
data: Data(utf8),
|
|
options: [
|
|
.documentType: NSAttributedString.DocumentType.html,
|
|
.characterEncoding: String.Encoding.utf8.rawValue
|
|
],
|
|
documentAttributes: nil
|
|
)
|
|
|
|
return attributedString?.string ?? self
|
|
}
|
|
}
|