Last active
November 26, 2023 14:28
-
-
Save vincent-peng/07897b760c9e27573957a4cf7d10b5ee to your computer and use it in GitHub Desktop.
Convert Data to hex string in Swift
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
// http://stackoverflow.com/a/40089462 | |
extension Data { | |
func hexEncodedString() -> String { | |
return map { String(format: "%02hhx", $0) }.joined() | |
} | |
} |
Niceeee, thanks!
you saved my day big time - THANK YOU
Very good.
Any quick way to do the reverse, ie to create a Data
from a hex-encoded string?
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great!