nsstring stringByReplacingOccurrencesOfString 沮丧?
我正在尝试替换/删除这个:
[\"
from string Bump3
NSString *bump5 = [bump3 stringByReplacingOccurrencesOfString:@"[\\"" withString:@""];
错误:缺少终止“”字符。
有人可以帮我吗?我的大脑因盯着这个屏幕而焦躁不安。
更新:
偶然发现了这一点并且尝试了一下!
@“\”是一个反斜杠 @“\\”是一个双反斜杠
,所以我用了 NSString *bump5 = [bump3 stringByReplacingOccurrencesOfString:@"[\\"" withString:@""];
I am trying to replace/remove this:
[\"
from string bump3
NSString *bump5 = [bump3 stringByReplacingOccurrencesOfString:@"[\\"" withString:@""];
ERROR: missing terminating "" character.
could someone please help me out? My brain is so fried from staring at this screen..
UPDATE:
Figured it out by chance and tried it out!
@"\" is a single backslash
@"\\" is a double backslash
so I used
NSString *bump5 = [bump3 stringByReplacingOccurrencesOfString:@"[\\"" withString:@""];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该转义
\
和"
You should escape both
\
and"
尝试从字符串中删除“-”。
例如链 2773848-2294-2929
结果将返回以下字符串:
277384822942929
Try this to remove a "-" from a string.
for example a chain 2773848-2294-2929
The result will return the following string:
277384822942929