NSString中的字符编码 [英] Character encoding in NSString
本文介绍了NSString中的字符编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个iOS应用程序,我有一个基本的问题。我花了很多时间来解决它,但是我没有成功。
I am working on an iOS application and I have a basic problem. I have spent many hours to resolve it but I haven't had any success.
我有一些像这样的JSON: {htmlCode: < thead>< tr>< td class = //>< p>受保护.....
I have some JSON like this : {"htmlCode":"<thead><tr><td class=/"/"><p>Protected.....
SBJsonParser *jsonParser = [[[SBJsonParser alloc]init]autorelease];
NSDictionary *results = [jsonParser objectWithString:jsonTableData];
NSLog(@" result %@",results);
result (null)
是: //
- 如何替换为 \\
?
My problem is the :/"/"
- how I can replace it with \"\"
?
我想这样做:
jsonTableData = [jsonTableData stringByReplacingOccurrencesOfString:@"/"/"" withString:@"\"\""];
推荐答案
您可以像这样替换字符串中的字符!
You can replace characters in string like this!
NSString *str = @"<thead><tr><td class=/\"/\"><p>Protected";
NSLog(@"%@", str);
str = [str stringByReplacingOccurrencesOfString:@"/" withString:@"\\"];
NSLog(@"%@", str);
这篇关于NSString中的字符编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文