我有一些变量都实现了,只是tarih1
输出显示
Optional(2016)
。我没有解决。我想将其修复为2016
.
我的代码如下。
if let myString: String = String(seans.SeanceDate) {
let myStringArrf = myString.componentsSeparatedByString("T")
let tarih: NSString = myStringArrf[0]
let saat: String = String(myStringArrf[1])
let myStringArrf2 = saat.componentsSeparatedByString(":")
let saat1: String = myStringArrf2[0]
let saat2: String = myStringArrf2[1]
cell.saat.text = "\(saat1):\(saat2)"
cell.saat2.text = "\(saat1):\(saat2)"
let myStringArrf23 = tarih.componentsSeparatedByString("-")
let tarih1: NSString = myStringArrf23[0]
let tarih2: NSString = myStringArrf23[1]
let tarih3: NSString = myStringArrf23[2]
let sontarih: String = ("\(tarih3)-\(tarih2)-\(tarih1)")
cell.tarih.text = sontarih
print(sontarih)
}