Re: Probably a silly question but...
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.