Created
July 25, 2015 11:18
-
-
Save tobiassteenweg/02c58e8fe7d4c9cede3c to your computer and use it in GitHub Desktop.
encodeURIComponent() in swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func encodeURIComponent() -> String? { | |
var characterSet = NSMutableCharacterSet.alphanumericCharacterSet() | |
characterSet.addCharactersInString("-_.!~*'()") | |
return self.stringByAddingPercentEncodingWithAllowedCharacters(characterSet) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// Swift 4