swift 去除字符串中首尾位置的空格

var  originalStr = "   woqu  haha   "

let  afterStr = originalStr.trimmingCharacters(in: CharacterSet.whitespaces)

// afterStr = "woqu  haha"

你可能感兴趣的:(iOS)