直接上代码
/*
* 字符串转字典(NSString转Dictionary)
* parameter
* turnString : 需要转换的字符串
*/
+ (NSDictionary *)turnStringToDictionary:(NSString *)turnString
{
NSData *turnData = [turnString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *turnDic = [NSJSONSerialization JSONObjectWithData:turnData options:NSJSONReadingMutableLeaves error:nil];
return turnDic;
}
结语
小代码拼出大智慧!
~~ 劝君努力,势必成功! ~~
网友评论