NSString to NSData / NSData to NSString

Hilfreiche Codeschnipsel:

NSString to NSData

NSData *myData;
myData = [myString dataUsingEncoding: NSUTF8StringEncoding];

NSData to NSString

NSString *myStr;
myStr = [[[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding] autorelease];

Leave a Reply

Your email address will not be published.