ios - NSURLComponents 中的 Swift 4 转义 & 符号
问题描述
我在 Swift 4 中使用 NSURLComponents,如下所示:
let urlComponents = NSURLComponents(string: webservice + "?PDFFile=" + PDFFile);
我的字符串 PDFFile 看起来像这样:
汤姆和简 PDF.pdf
我的问题是如何转义 NSURLComponents 中的 & 符号?
这就是我得到的:
ANC%2520%26%2520SHO%2520-%2520Laundry%2520Closets%2520to%2520be%2520Checked.pdf
但这就是我需要的:
ANC+%26+SHO+-+Laundry+Closets+to+be+Checked.pdf
解决方案
推荐阅读
- sql - 在 Biztalk 中使用 WCF-SQL 适配器上的模板消息体将提升的属性插入 SQL 数据库
- wso2 - WSO2SP 作为 APIM 和 EI 的分析
- ios - ios - 存在自定义类时模块字段为空
- android - 使用 Cordova 开发的 Android 应用程序可以离线工作吗?
- powerbi - Power BI - 给定日期的 2 个表的加权平均收益率
- c++ - 在类方法之外返回共享指针引用中断
- c++ - lambda 中的嵌套 std::bind 不能转换为 std::function(来自 void*)
- python - 如何在使用 pyspark shell 时导入额外的 python 包
- python - 如何在 AutoMLConfig 中将参数传递给 get_data 脚本
- ios - 使用 Swift 4 关闭 iOS 中的所有模式