Last active
August 22, 2025 06:00
-
-
Save abhi21git/484c4103450e572fed900daa18add712 to your computer and use it in GitHub Desktop.
Access characters of string just like array
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
extension String { | |
subscript(_ i: Int) -> Character { | |
self[index(startIndex, offsetBy: i)] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment