
Swift
浩瀚星空001
这个作者很懒,什么都没留下…
展开
-
Swift3.0 截取字符串
import UIKitvar str = "Hello, playground"let index1 = str.index(str.startIndex, offsetBy: 7)let subStr1 = str.substring(from: index1) //subStr1结果为 playground let index2 = str.index(str.endIndex, offset原创 2016-10-24 15:02:06 · 299 阅读 · 0 评论 -
学习swift3.0的一些问题
1.判断字典中是否含有某个key值 import UIKitlet dict: NSDictionary = ["key1":"zhang","key2":"zhong"]//第一种方法:swift3.0的方法 let X: Bool = dict.allKeys.contains { (key) -> Bool in print(key) if key as! String ==原创 2016-11-01 10:43:02 · 635 阅读 · 0 评论