let name : String = "YYY"
for c in name.characters {
print(c)
}
//字符串拼接
let str1 = "我的名字"
let str2 = "小明"
let str3 = str1 + str2
//字符串拼接基本数据类型
let name = "小明"
let age = 18
let height = 170
let info = "我的名字叫\(name),我的年龄是\(age),我的身高是\(height)cm"
//字符串冯世华
let n = 2
let s = 8
let time1 = String.init(format: "%02d:%02d", arguments: [n,s])
//字符串方法截取
let string = "www.baidu.com"
let head = (string as NSString).substring(to: 3)
let middle = (string as NSString).substring(from: 10)
let bottom = (string as NSString).substring(with: NSMakeRange(4, 5))