Last active
July 19, 2021 21:02
-
-
Save jong9000/0d6f7076d9218f832dd96016a1f2d612 to your computer and use it in GitHub Desktop.
String Extensions
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
// String Extensions | |
// https://www.simpleswiftguide.com/get-character-from-string-using-its-index-in-swift/ | |
extension StringProtocol { | |
subscript(offset: Int) -> Character { | |
self[index(startIndex, offsetBy: offset)] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment