Re: Int Val of Hex From NSData
Re: Int Val of Hex From NSData
- Subject: Re: Int Val of Hex From NSData
- From: Gregory Weston <email@hidden>
- Date: Mon, 10 Mar 2003 09:08:27 -0800
On Monday, March 10, 2003, at 07:35AM, Seth Willits <email@hidden> wrote:
>
If I have an NSData object that has three bytes in it (A9B), how can I
>
get the integer equivalent (2715)?
I'm not sure what you've actually got. If it's actually 3 bytes, you've already gotten the answer from someone, but I have this suspicion that what you actually have is an ASCII representation of a 12-bit number. In that case you iterate over your data one character at a time doing a 4-bit left shift and then adding the offset of the character within the string "0123456789ABCDEF".
G
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.