📜  快速获取索引过滤器代码示例

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

代码示例1
let items: [String] = ["A", "B", "A", "C", "A", "D"]  
print(items.enumerated().filter({ $0.element == "A" }).map({ $0.offset })) // -> [0, 2, 4]