如何使用Swift从字符串中删除,而不是解码百分比转义字符.例如:
"hello%20there"
应该成为
"hellothere"
编辑:
我想替换字符串中的多个转义百分比字符.所以:
"hello%20there%0Dperson"
应该成为
"hellothereperson"
let string = originalString.replacingOccurrences(of: "%[0-9a-fA-F]{2}",
with: "",
options: .regularExpression,
range: nil)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1360 次 |
| 最近记录: |