using evernote api, have object has nsuinteger property called hash
. specific object i'm looking at, equal to:
<f5b5444b 33e740b7 f9d49a3b ddb6a39c>
i want convert nsstring. doing this:
[nsstring stringwithformat:@"%d", noteresource.hash]
gives me this:
530049088
how correctly convert hash value nsstring?
when see output "<" 8 hex digits space .... ">", it's result of logging nsdata object (nslog(@"%@", mydataobject);
). believe have not nsuinteger
, nsdata *
object.
there no built in method convert between strings , data, need in code:
- (nsstring *)datatostring:(nsdata *)data { nsuinteger len = [data length]; nsmutablestring *str = [nsmutablestring stringwithcapacity:len*2]; const uint8_t *bptr = [data bytes]; while(len--) [str appendformat:@"%02.2x", *bptr++]; return str; }
if works, can write own stringtodata method reversing above, if needed.
Comments
Post a Comment