开发者

Converting String to long long value

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜