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: Peter Zegelin <email@hidden>
- Date: Thu, 27 Aug 2009 19:12:39 +1000
Sorry Graham - I should have mentioned that the color is rgba within
the uint32.
Thanks everyone - Robs solution worked great, though I'll have to
strip off the # first and then shift to the left a further 8 bits.
Never used NSScanner before but its a good solution.
On 27/08/2009, at 9:50 AM, 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
_______________________________________________
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