开发者

NSString integerValue returns a number in hex

NSString *x = @"12345";开发者_Go百科
NSInteger nsint = [x integerValue];  
NSLog(@"%x", nsint);

Prints 3039. intValue has the same result. Any idea how I can get the actual decimal value out of that?


  NSLog(@"%d", nsint);

%x means hex format. (See http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265 for all format specifiers.)


NSLog(@"%d", nsint);

%x prints hex; %d prints decimal.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜