Re: Making an NSString from NSData
Re: Making an NSString from NSData
- Subject: Re: Making an NSString from NSData
- From: Jeffrey J Barbose <email@hidden>
- Date: Mon, 22 Oct 2001 19:46:44 -0700
if you know that the NSString contains simple ascii data (like a
c-string or a pascal string), the simple case is something like this:
NSString* myString = "foo";
NSData* myData = [NSData dataWithBytes:[myString cString]
length:[myString cStringLength]];
you can also look at NSStringEncodings and getCharacters... for
unicode and other encodings of strings..
At 19.13 -0700 01/10/22, Sam Goldman wrote:
How do I make an NSString into NSData? Do have to go through every byte and
put that into a string? I don't really know what NSData is because it can
contain images (as I learned from cocoadevcentral's image buddy) and I just
don9t know what its content would be. Sorry for the newbie question, but I
couldn't do it when I tried.
- Sam
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev