iOS swift-开发笔记
2017-04-28 本文已影响15人
青菜白玉堂
//*****//获取对象类型
object_getClass(对象)
//*****//数字类型字符串转Int
let powerint : Int = Int(data["battery2"] as! String)!
//*****//判断大小dataInfo["amount"] as! String ="2.00"
let amount = dataInfo["amount"] as! String
let duo = 0.00
if Double(amount)! > duo{
}
//*****//判断字典为空
dic.allKeys.count==0
//*****//判断字典某一key是否存在
dic.object(forKey: "id") != nil
//*****//判断字典某一key的值是否为NSNull
dic["wall"] is NSNull
//*****//判断字符串1中含有另一字符串2
if (字符串1.range(of: "字符串2") != nil) {
}
//*****//判断替换字符串中某一字符
let version1 = iosgengXin["version"] as! String
let version2 = version1.replacingOccurrences(of: ".", with: "")
//*****//获取绝对值
abs(-1) == 1