Re: How to Convert "#FF00FF" String Specifying RGB Color to 32 bit int
Re: How to Convert "#FF00FF" String Specifying RGB Color to 32 bit int
- Subject: Re: How to Convert "#FF00FF" String Specifying RGB Color to 32 bit int
- From: Waqar Malik <email@hidden>
- Date: Wed, 26 Aug 2009 17:02:09 -0700
Peter,
I use NSScanner to parse the string to get individual values.
NSRange range = NSMakeRange(1, 2);
NSUInteger value = 0;
[[NSScanner scannerWithString:[string substringWithRange:range]]
scanHexInt:&value]
// WARNING: code typed in email
--Waqar
On Aug 26, 2009, at 4:50 PM, Peter Zegelin wrote:
Hi,
I have some xml where an rgb color value is specified via a
"#XXYYZZ" type string. The xml is being read in via NSXMLParser. I
can't seem to find an easy Cocoa way to convert this value to an
unsigned int. I need an unsigned int rather than an NSColor as the
value is used in C++ code. Does anyone know of something I may be
missing?
Thanks!
Peter
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden