1.  首页
  2.  博客
  3. NSData to NSString and NSString to NSData

NSData to NSString and NSString to NSData


哎,经常忘记。 年纪大了记忆力越来越差了!

NSDate to NSString:

NSString * str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

NSString to NSData:

NSData * data
data = [str dataUsingEncoding:NSUTF8StringEncoding];

评论 0