ChWebsiteApp/CHDataManagement/Extensions/String+Extensions.swift
2024-11-20 23:46:54 +01:00

16 lines
413 B
Swift

extension String {
func htmlEscaped() -> String {
replacingOccurrences(of: "&", with: "&")
.replacingOccurrences(of: "\"", with: """)
.replacingOccurrences(of: "'", with: "'")
.replacingOccurrences(of: "<", with: "&lt;")
.replacingOccurrences(of: ">", with: "&gt;")
}
var nonEmpty: String? {
isEmpty ? nil : self
}
}