• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Int Val of Hex From NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: pasteFont in plain NSTextView
  • Next by Date: Please evaluate a wake/sleep catch...
  • Previous by thread: Re: Int Val of Hex From NSData
  • Next by thread: Re: CFDictionaryGetValue case insensitive
  • Index(es):
    • Date
    • Thread