gpt4 book ai didi

ios - xcode - 如何提取由字符分隔的字符串的一部分“

转载 作者:行者123 更新时间:2023-11-29 03:13:29 27 4
gpt4 key购买 nike

我有一个字符串,我需要提取完整的 http 地址以便将其传递给 Safari。

我的字符串是:

<a href="http://maps.google.com/maps?q=Example Street, 1,  Rome">Example Street, 1</a>

如何只得到:

http://maps.google.com/maps?q=Example Street, 1,  Rome

那个包含在“特殊字符中?”

提前致谢。

最佳答案

不是最快的解决方案,但可能是最短的解决方案

[yourString componentsSeparatedByString:@"\""][1];

如果您的字符串有可能没有两个 "符号,您应该检查

[yourString componentsSeparatedByString:@"\""].length

第一

关于ios - xcode - 如何提取由字符分隔的字符串的一部分“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21959423/

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