stringByAddingPercentEncodingWithAllowedCharacters中NSCharacterSet (NSURLUtilities)

To escape character use stringByAddingPercentEncodingWithAllowedCharacters:

NSString *URLEscapedString =

[string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

The following are useful character sets:

URLFragmentAllowedCharacterSet  "#%<>[\]^`{|}

URLHostAllowedCharacterSet      "#%/<>?@\^`{|}

URLPasswordAllowedCharacterSet  "#%/:<>?@[\]^`{|}

URLPathAllowedCharacterSet      "#%;<>?[\]^`{|}

URLQueryAllowedCharacterSet    "#%<>[\]^`{|}

URLUserAllowedCharacterSet      "#%/:<>?@[\]^`

你可能感兴趣的:(stringByAddingPercentEncodingWithAllowedCharacters中NSCharacterSet (NSURLUtilities))