📜  swift代码示例中的字符串索引

📅  最后修改于: 2022-03-11 15:01:00.544000             🧑  作者: Mango

代码示例2
extension String {
    subscript(_ n: Int) -> Character {
        return self[self.index(self.startIndex, offsetBy: n)]
    }
}

let str = "Hello World"

for i in 0..