gpt4 book ai didi

objective-c - 从 NSString 中删除双引号

转载 作者:太空狗 更新时间:2023-10-30 03:56:00 26 4
gpt4 key购买 nike

如何从 NSString 中删除双引号。示例:

//theMutableString: "Hello World"

[theMutableString replaceOccurrencesOfString:@"\"" withString:@"" options:NSCaseInsensitiveSearch range:(NSRange){0,[theMutableString length]}]

它似乎不起作用,也许是因为我不得不在 replaceOccurrencesOfString 中转义 "?

最佳答案

使用 NSMakeRange 函数代替您的转换。这会起作用:

[mString replaceOccurrencesOfString:@"\"" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mString length])];

关于objective-c - 从 NSString 中删除双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2124860/

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