• 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: Probably a silly question but...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Probably a silly question but...


  • Subject: Re: Probably a silly question but...
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 10 Jun 2004 02:07:34 -0400

On Jun 10, 2004, at 12:30 AM, April Gendill wrote:

Ok, I have a string which is actually a hex number. how would I convert that hex number into an integer?

unsigned i;
BOOL b = [[NSScanner scannerWithString:@"0xDEADBEEF"] scanHexInt:&i];

if (b) {
NSLog(@"Scan succeeded, result is %d", i);
} else {
NSLog(@"Scan failed");
}

The leading "0x" is optional.

sherm--
_______________________________________________
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.


References: 
 >Probably a silly question but... (From: April Gendill <email@hidden>)

  • Prev by Date: Re: two things (newbie)
  • Next by Date: Multiple NSDocument Types in a Document-Based Architecture
  • Previous by thread: Probably a silly question but...
  • Next by thread: Re: Probably a silly question but...
  • Index(es):
    • Date
    • Thread