Ich suche immer oft, also werde ich es zusammenfassen.
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"]
Wenn Sie "C" löschen möchten, geben Sie etwas anderes als "C" mit Filter an.
var strArray = ["A","B","C","D","E"]
strArray = strArray.filter { $0 != "C" } // ["A", "B", "D", "E"]
Recommended Posts