Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString
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