• 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: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString


  • Subject: Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
  • From: "Michael Ash" <email@hidden>
  • Date: Sun, 11 Jan 2009 14:37:59 -0500

On Sun, Jan 11, 2009 at 1:24 AM,  <email@hidden> wrote:
>   This is what I did in my project, using the code below. I can't
> help feeling that this code is dirty because it relies on the character
> for the "j" digit being indexed as unichar number j+48. Can anyone
> tell me what would be the clean way to do this ?

Would be much cleaner IMO to simply use the built-in function strtoull:

- (unsigned long long)unsignedLongLongValue { return strtoull([self
UTF8String], NULL, 0); }

If you need error checking then it can also be accomplished using this
function with a little more work.

Mike
_______________________________________________

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

References: 
 >How to add a -(unsigned long long)unsignedLongLongValue method to NSString (From: email@hidden)

  • Prev by Date: Getting the network Machine Icon
  • Next by Date: Re: Recording video from a QCView to .mov
  • Previous by thread: Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
  • Next by thread: Highlighting an NSPopUpButtonCell subclass
  • Index(es):
    • Date
    • Thread