I always search many times, so I will summarize it.
var strArray = ["A","B","C","D","E"]
strArray.removeFirst() //["B", "C", "D", "E"]
var strArray = ["A","B","C","D","E"]
strArray.removeLast() //["A", "B", "C", "D"]
var strArray = ["A","B","C","D","E"]
strArray.removeAll() //[]
var strArray = ["A","B","C","D","E"]
strArray.removeAll(where: {$0 == "C"}) // ["A", "B", "D", "E"]
var strArray = ["A","B","C","D","E"]
strArray.remove(at: 2) //["A", "C", "D", "E"]
If you want to delete "C", specify something other than "C" with filter.
var strArray = ["A","B","C","D","E"]
strArray = strArray.filter { $0 != "C" } // ["A", "B", "D", "E"]
Recommended Posts