NSString

  • Returns a copy of the current String where 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)
    a a Not escaped (alphanumerical)

    Declaration

    Swift

    public func addingUnicodeEntities() -> NSString
  • Returns a copy of the current String where 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)
    a a Not escaped (alphanumerical)

    Performance

    If your webpage is unicode encoded (UTF-16 or UTF-8) use addingUnicodeEntities instead, as it is faster and produces a less bloated and more readable HTML.

    Declaration

    Swift

    public func addingASCIIEntities() -> NSString
  • Returns a copy of the current String where every HTML entity is replaced with the matching Unicode character.

    Examples

    String Result Format
    & & Keyword entity
    Σ Σ Decimal entity
    č č Hexadecimal entity
    🇺🇸 🇺🇸 Combined decimal entities (extented grapheme cluster)
    a a Not an entity
    & & Not an entity

    Declaration

    Swift

    public func removingHTMLEntities() -> NSString