Created
January 13, 2016 17:17
-
-
Save ericdke/fe3dea5a9b2cac9edd88 to your computer and use it in GitHub Desktop.
This file contains 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 NSCharacterSet { | |
var characters:[String] { | |
var chars = [String]() | |
for plane:UInt8 in 0...16 { | |
if self.hasMemberInPlane(plane) { | |
for (var c:UTF32Char = UInt32(plane) << 16; c < (UInt32(plane) + 1) << 16; c += 1) { | |
if self.longCharacterIsMember(c) { | |
let s = NSString(bytes: &c, length: 4, encoding: NSUTF32LittleEndianStringEncoding)! | |
chars.append(String(s)) | |
} | |
} | |
} | |
} | |
return chars | |
} | |
} | |
let charset = NSCharacterSet.URLQueryAllowedCharacterSet() | |
print(charset.characters.joinWithSeparator("")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment