gpt4 book ai didi

ios - 第二个正斜杠会发生什么?

转载 作者:搜寻专家 更新时间:2023-11-01 06:46:16 26 4
gpt4 key购买 nike

为什么

"http://blah/".stringByAppendingPathComponent("foo")

返回

"http:/blah/foo"

注意去掉的正斜杠。

最佳答案

如果您阅读 stringByAppendingPathComponent 的文档,您将看到以下语句:

Note that this method only works with file paths (not, for example, string representations of URLs).

stringByAppendingPathComponent 的实现正在“修复”它认为格式错误的文件路径。

您应该使用 NSURL 或 stringByAppendingString。

关于ios - 第二个正斜杠会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30408281/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com