Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing 64-bit unsigned integer on iOS

I have very big unsigned integral number in NSString. This may be big to 2^64. Is there an existing functions/classes parsing this?

As I know, it's unsigned long long value, but, It's hard to know what kind of method should I use to parse this.

like image 518
eonil Avatar asked Dec 29 '22 06:12

eonil


1 Answers

Perhaps not the prettiest answer, but you should be able to do something like this:

#include <stdlib.h>
...
unsigned long long parsedValue = strtoull([yourString UTF8String], NULL, 0);

Someone else might have a more cocoa-ey way of doing it.

like image 101
Stephen Canon Avatar answered Feb 12 '23 00:02

Stephen Canon