Substring

public extension Substring

This extension provides methods for encoding and decoding strings using Punycode (RFC 3492) and IDNA encoding. It allows for the conversion of Substring instances to their Punycode and IDNA representations, facilitating the handling of internationalized domain names.

  • Returns new string in punycode encoding (RFC 3492)

    Declaration

    Swift

    var punycodeEncoded: String? { get }

    Return Value

    Punycode encoded string or nil if the string can’t be encoded

  • Returns new string decoded from punycode representation (RFC 3492)

    Declaration

    Swift

    var punycodeDecoded: String? { get }

    Return Value

    Original string or nil if the string doesn’t contain correct encoding

  • Returns new string containing IDNA-encoded hostname

    Declaration

    Swift

    var idnaEncoded: String? { get }

    Return Value

    IDNA encoded hostname or nil if the string can’t be encoded

  • Returns new string containing hostname decoded from IDNA representation

    Declaration

    Swift

    var idnaDecoded: String? { get }

    Return Value

    Original hostname or nil if the string doesn’t contain correct encoding