Created
October 31, 2016 07:55
-
-
Save toshi0383/6e59abaf3e651811fc1cc1e5ba9e943b to your computer and use it in GitHub Desktop.
ついついintをsubscriptに突っ込みたくなるけど違うんでしたねー。 #CodePiece
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 a = "89078" | |
for i in (0..<a.characters.count) { | |
// let index: Int = i // <= wrong! | |
let index: String.CharacterView.Index = | |
a.characters.index(a.startIndex, offsetBy: i) | |
print(a[index]) | |
} | |
// 8 | |
// 9 | |
// 0 | |
// 7 | |
// 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment