import Foundation import Glibc var buffered_data: [String: Any] = [:] var dictArray:[Int] = [] buffered_data.updateValue(0, forKey: "t") buffered_data.updateValue(4444, forKey: String(4)) buffered_data.updateValue(2222, forKey: String(2)) buffered_data.updateValue(5555, forKey: String(5)) var sortedByKeyDictionary = buffered_data.sorted { firstDictionary, secondDictionary in return firstDictionary.0 < secondDictionary.0 // 由小到大排序 } print(sortedByKeyDictionary.popLast()!) print(buffered_data) print(sortedByKeyDictionary) for (k, v) in sortedByKeyDictionary { dictArray.append(v as! Int ) } print(dictArray) var a = ["1","2","3"] if let index = a.index(of: "2") { a.remove(at: index) } print(a)
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more