Skip navigation.
 
mlRe: Hexadecimal addition
FROM : Charles Steinman
DATE : Tue Nov 06 22:05:33 2007

--- deepak gopal <<email_removed>> 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

Related mailsAuthorDate
mlHexadecimal addition deepak gopal Nov 6, 21:34
mlRe: Hexadecimal addition Charles Steinman Nov 6, 22:05
mlRe: Hexadecimal addition Keary Suska Nov 6, 23:20