【问题标题】:Decoding Percent-Encoded String in Swift 4.2? [duplicate]在 Swift 4.2 中解码百分比编码的字符串? [复制]
【发布时间】:2020-12-12 01:12:30
【问题描述】:

我正在尝试解码百分比编码的字符串,但不知道如何解码。例如:

let str = "Hello%20World"

// I want to decode 'str' to 'Hello World'

有谁知道在 Swift 4.2 中执行此操作的最佳方法?谢谢。

【问题讨论】:

    标签: cocoa swift4.2


    【解决方案1】:

    要删除百分比编码,我会调用removingPercentEncoding 方法。

    https://developer.apple.com/documentation/foundation/nsstring/1409569-removingpercentencoding

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-13
      • 2021-10-10
      • 1970-01-01
      • 2011-03-26
      • 2011-08-11
      • 1970-01-01
      相关资源
      最近更新 更多