String
extension String
-
Returns a copy of the current
Stringwhere every character incompatible with HTML Unicode encoding (UTF-16 or UTF-8) is replaced by a decimal HTML entity.Examples
String Result Format &&Decimal entity (part of the Unicode special characters) ΣΣNot escaped (Unicode compliant) 🇺🇸🇺🇸Not escaped (Unicode compliant) aaNot escaped (alphanumerical) Declaration
Swift
public func addingUnicodeEntities() -> String -
Returns a copy of the current
Stringwhere every character incompatible with HTML ASCII encoding is replaced by a decimal HTML entity.Examples
String Result Format &&Decimal entity ΣΣDecimal entity 🇺🇸🇺🇸Combined decimal entities (extented grapheme cluster) aaNot escaped (alphanumerical) Performance
If your webpage is unicode encoded (UTF-16 or UTF-8) use
addingUnicodeEntitiesinstead, as it is faster and produces a less bloated and more readable HTML.Declaration
Swift
public func addingASCIIEntities() -> String
-
Replaces every HTML entity in the receiver with the matching Unicode character.
Examples
String Result Format &&Keyword entity ΣΣDecimal entity ččHexadecimal entity 🇺🇸🇺🇸Combined decimal entities (extented grapheme cluster) aaNot an entity &&Not an entity Declaration
Swift
public func removingHTMLEntities() -> String
View on GitHub
Install in Dash
String Extension Reference