Instance Method

addingPercentEscapes(using:)

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.

Declaration

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

Parameters

encoding

The encoding to use for the returned string. If you are uncertain of the correct encoding you should use NSUTF8StringEncoding.

Return Value

A representation of the receiver using encoding to determine the percent escapes necessary to convert the receiver into a legal URL string. Returns nil if encoding cannot encode a particular character.

Discussion

It may be difficult to use this function to "clean up" unescaped or partially escaped URL strings where sequences are unpredictable. See CFURLCreateStringByAddingPercentEscapes(_:_:_:_:_:) for more information.

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.

func replacingPercentEscapes(using: UInt)

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

var removingPercentEncoding: String?

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