Ron*_*nak -25 replace objective-c nsstring ios
我有一个NSString,我试图替换特殊字符.我的部分字符串如下所示:
我已经取代'了\'
Apo*_*orv 12
如果您想更换'与\'使用
NSString *str = @"ladies'";
str = [str stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"];
Run Code Online (Sandbox Code Playgroud)
\ 是一个转义字符,所以你必须使用它两次.
注意: \是目标c中的转义字符.
NSString *s = @"This is Testing Mode and we are testing just Details of this Ladies' Market place";
NSString *r = [s stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1283 次 |
| 最近记录: |