Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute Swift Online

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)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.