开发者

Converting String to long long value

开发者 https://www.devze.com 2022-12-11 02:27 出处:网络
In my application I have to convert string to long long data type and it should also be supported for Tiger OS.

In my application I have to convert string to long long data type and it should also be supported for Tiger OS.

So I can not directly use longLongValue on NSString because it is supported for Mac OS Version 10.5 and later.

So I am converting string value to long long by the following method :

+ (long long) convertToLongLong:(NSString*) inString
{
    return [[[[NSNumber alloc] initWithDouble:[inString doubleValue]] autorelease] longLongValue];
}

I just wanted to know will it required an开发者_StackOverflowy overflow or underflow conditions, and if required then how to use that.


Convert to a C string, then use the C99 function strtoll( ), declared in <stdlib.h>.

0

精彩评论

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