Instance Method

replacingPercentEscapes(using:)

Returns a new string made by replacing in the receiver all percent escapes with the matching characters as determined by a given encoding.

Declaration

func replacingPercentEscapes(using enc: UInt) -> String?

Parameters

encoding

The encoding to use for the returned string.

Return Value

A new string made by replacing in the receiver all percent escapes with the matching characters as determined by the given encoding encoding. Returns nil if the transformation is not possible, for example, the percent escapes give a byte sequence not legal in encoding.

Discussion

See CFURLCreateStringByReplacingPercentEscapes(_:_:_:) for more complex transformations.

See Also

Related Symbols

func addingPercentEncoding(withAllowedCharacters: CharacterSet)

Returns a new string made from the receiver by replacing all characters not in the specified set with percent-encoded characters.

var removingPercentEncoding: String?

Returns a new string made from the receiver by replacing all percent encoded sequences with the matching UTF-8 characters.

func addingPercentEscapes(using: UInt)

Returns a representation of the receiver using a given encoding to determine the percent escapes necessary to convert the receiver into a legal URL string.