I have a very big integer value in decimal which i put in NSString , i need to convert to NSString of Bytes value for this big value how can i do it? FYI the length of NSSting is "308"
Please help
Thanks
I have a very big integer value in decimal which i put in NSString , i need to convert to NSString of Bytes value for this big value how can i do it? FYI the length of NSSting is "308"
Please help
Thanks
What do you mean "string of bytes"?
In particular, an NSString can only encapsulate strings with valid unicode (and some more primitive non-unicode) encodings. Thus, "string of bytes" may not actually make sense.
If you really want raw bytes, you can convert it to an NSData instance using the dataUsingEncoding:*
methods (there are two, depending on need).
To do this, you'll need to do the following(assuming you want a UTF8-encoded byte stream):
NSString *myString; //Assuming your string is here
NSData *stringData = [myString dataUsingEncoding:NSUTF8StringEncoding]; //This is the NSData representation of the string
const void *bytes = [stringData bytes]; //This are the raw bit array values