Created
January 17, 2024 20:28
-
-
Save codelynx/e4a544a880eea77386345ea46964a1e1 to your computer and use it in GitHub Desktop.
utility extension convert UnsafePointer<UInt8> to String?
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 UnsafePointer<UInt8> { | |
var string: String? { | |
return String(validatingUTF8: UnsafeRawPointer(self).assumingMemoryBound(to: CChar.self)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment