var a = ["A","C","D","F","E"]
var b = ["A","C","D","F","8"]
//增
a = a + [8,9]
//删除
a.remove(at: 1)
//改
a[0] = 10
//插入
a.insert(88, at: 2)
//判断是否在里面
print(a.contains(88))
//排序
a.sort((s1,s2) -> Bool in
if s1 < s2 {
return true
}
return false
)
//过滤
a = a.filter { (item) -> Bool in
if item == "D" {
return true
}
return false
}
//判断是否相等
print(a == b)
//遍历对象
for item in a[1...2] {
print(item)
}
//遍历索引
for item in (0..<a.count) {
print(item)
}