I think this should do the trick:
@implementation NSString (HexIntValue)
- (unsigned int)hexIntValue
{
NSScanner *scanner;
unsigned int result;
scanner = [NSScanner scannerWithString: self];
[scanner scanHexInt: &result];
return result;
}
@end
Note that I would expect -hexValue to be a method of NSNumber, that
would return an NSString of the receiver's hex-value representation. I
titled the method above 'hexValueInt' to more closely match NSString's
-intValue, -floatValue, etc.
David
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]