Last active
May 19, 2016 16:22
-
-
Save mAu888/f6999fe52b5092c32d4e8e9df5f8fc73 to your computer and use it in GitHub Desktop.
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 { | |
var bytes: [UInt8]? { | |
return dataUsingEncoding(NSUTF8StringEncoding) | |
.flatMap { data in | |
return (0..<data.length).map { | |
UnsafeMutablePointer<UInt8>(data.bytes.advancedBy($0)).memory | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment