Last active
September 6, 2023 09:28
-
-
Save clarkeben/ac9e6fcc6607f24c8fbb5a2294e43b41 to your computer and use it in GitHub Desktop.
Swift Strings
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
let data = Data("Hello, world!".utf8) | |
let string = String(data: data, encoding: .utf8) |
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
let string = "Hello, world!" | |
let optionalData = string.data(using: .utf8) ///"Optional(13 bytes) |
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
let string = "Hello, world!" | |
let data = Data(string.utf8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment