Last active
September 14, 2023 15:05
-
-
Save clarkeben/facf50d0a2d82ab80f91e4c6e0d71870 to your computer and use it in GitHub Desktop.
subtrings-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
let str = "Apple" | |
let index = str.index(str.startIndex, offsetBy: 3) | |
let mySubstring = str.prefix(upTo: index) |
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 str = "Apple" | |
let index = str.index(str.startIndex, offsetBy: 3) | |
let mySubstring = str.prefix(upTo: index) | |
let substringToString = String(mySubstring) //App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment