var str_trim = " !hi !23 !"
str_trim.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())//"!hi !23 !"去掉两边的空格
str_trim.stringByTrimmingCharactersInSet(NSCharacterSet(charactersInString: "! "))//"hi !23" 去掉两边的空格和‘!’ ,把 字符串中的每个字符进行了分解并去除
时间: 2024-10-05 22:12:30