• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Hexadecimal addition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Hexadecimal addition
      • From: Keary Suska <email@hidden>
References: 
 >Hexadecimal addition (From: deepak gopal <email@hidden>)

  • Prev by Date: Enabling cut and paste in modal window
  • Next by Date: Re: Struct introspection or information
  • Previous by thread: Hexadecimal addition
  • Next by thread: Re: Hexadecimal addition
  • Index(es):
    • Date
    • Thread