- 去除首尾的空格
// 去除空格
var getName:String = textField.text!
getName = getName.trimmingCharacters(in: .whitespaces)
- 替换文字
// 替换文字
strNewMem = strNewMem.replacingOccurrences(of: "\n \"\",", with: "")
strNewMem = strNewMem.replacingOccurrences(of: ",\n \"\"", with: "")
- 字符串分割
let da = "a,b,c"
let arr = da.components(separatedBy: ",")
print(arr)