for theChar in s.characters {
//something
}
效率:

for i in 0..<s.characters.count {
let theChar = s[s.index(s.startIndex, offsetBy: i)]
//something
}
效率:

for theChar in s.characters {
//something
}
效率:
for i in 0..<s.characters.count {
let theChar = s[s.index(s.startIndex, offsetBy: i)]
//something
}
效率:
本文标题:[Swift]字符串遍历效率记录
本文链接:https://www.haomeiwen.com/subject/slopittx.html
网友评论