开发者

NSString to 64-bit integer conversion on iPhone

开发者 https://www.devze.com 2023-01-15 21:10 出处:网络
I am struggling with very simple thing: I receive some ids by http request as a string. I know they represent 64-bit integer id numbers.

I am struggling with very simple thing: I receive some ids by http request as a string. I know they represent 64-bit integer id numbers. How can I convert them to the 64-bit Integers (NSNumber or NSInteger)?

Functions like:

[nsstring integerValue],
[nsstring intValue]

seems to be 32bit limited (max value:2147483647开发者_高级运维).

Any Hints?

Data model with 64bit integer properties compiles fine so it means iPhone supports such a numbers for a god sake. It must be some simple conversion method. It is so popular in http connection based devices.


have you tried longLongValue ?


if they have a fixed length, you could cut them on each 9th number, make the intvalue of the cutted parts and add the values with the 10^9-factor. surely not the most elegant way, but it should work

0

精彩评论

暂无评论...
验证码 换一张
取 消