gpt4 book ai didi

iphone - 如何从 NSString 中删除引号?

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

我正在尝试从以下内容中删除引号:

“你好”

这样字符串就是:

你好

最佳答案

查看 Apple 的文档:

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/

你可能想要:

stringByReplacingOccurrencesOfString:withString:

返回一个新字符串,其中接收方中所有出现的目标字符串都被另一个给定字符串替换。

- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement

所以,像这样的东西应该可以工作:

newString = [myString stringByReplacingOccurrencesOfString:@"\"" withString:@""];

关于iphone - 如何从 NSString 中删除引号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4121478/

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