从字符串转换

基本类型 / 布尔类型

let str = "true"
let nsStr = str as NSString
let boolValue = nsStr.boolValue
//boolValue is true

print("boolValue is \(boolValue)")