2
我試圖使用String.replacingOccurrences
更改下列字符的所有匹配到逗號:更換出現迅速的正則表達式
#.$[]
不過,我似乎無法得到它的什麼做到這一點我有:
func cleanStr(str: String) -> String {
return str.replacingOccurrences(of: "[.#$[/]]", with: ",", options: [.regularExpression])
}
print(cleanStr(str: "me[[email protected]#l.co$m")) // prints "me[[email protected],l,co,m\n"
有人能幫我看看我做錯了什麼嗎?
你我的好先生,是一個該死天才。天才! – MarksCode