我有两个像这样的数组:
var arrayA = ["Mike","James","Stacey","Steve"] var arrayB = ["Steve","Gemma","Lucy"]
如你所见,詹姆斯和史蒂夫匹配,我希望能够从arrayA中删除它们.我怎么写这个?
喜欢这个:
var arrayA = ["Mike","Lucy"] for word in arrayB { if let ix = find(arrayA,word) { arrayA.removeAtIndex(ix) } } // now arrayA is ["Mike","Stacey"]