Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下 NSString:
"This is a test String *This a test string"
我想用这样的返回替换“*”
"This is a test string This is a test string"
我试过:
[removeStr stringByReplacingOccurrencesOfString:@"*" withString:@"/r"];
但它打印“/r”,当我尝试“\r”时,我得到一个 lldb 错误
有什么帮助吗?
NSString *str = @"This is a test String*This a test string"; NSString *str2 = [str stringByReplacingOccurrencesOfString:@"*" withString:@"\n"]; NSLog(@"%@", str2);
如果这样的字符串, replace \n,那么结果是:
\n
This is a test String This a test string