let items: [String] = [\"A\", \"B\", \"A\", \"C\", \"A\", \"D\"] items.whatFunction(\"A\") // -> [0, 2, 4] items.whatFunction(\"B\") // -> [1]
just copy and paste
extension Array { func whatFunction(_ ids : String) -> [Int] { var mutableArr = [Int]() for i in 0..