Re: Hexadecimal addition
Re: Hexadecimal addition
- Subject: Re: Hexadecimal addition
- From: Charles Steinman <email@hidden>
- Date: Tue, 6 Nov 2007 13:05:33 -0800 (PST)
--- deepak gopal <email@hidden> wrote:
> I have an hexadecimal number in NSString. I want to
> add 0x1000 to my Hexadecimal number and print out
> the result.
>
> Say:
> NSString *hexString = @"2fffa";
> // I need to print
> hexString + 0x1000
> How can I do hexadecimal addition?
It's normal integer addition you want to do -- the hex
is just how it's displayed. You can get an integer out
of a string with NSFormatter's scanHexInt:, and you
can create a hex string representation of an integer
with [NSString stringWithFormat:@"%x", anInteger]
(though you might consider using an NSFormatter
subclass to format the data for output rather than
storing it that way, just as a thought).
Cheers,
Chuck
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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