开发者

NSString hex and decimal output?

NSString* s = [NSString stringWithFormat:@"dec:%qi, hex:%qX", 1, 1];

yields

dec: 4294967297, hex:BFFFD438000...

?开发者_StackOverflow社区?? why ???

thanks

if I use %d and %d, I get 1 and 1


q means 64-bit, so you have to pass 64-bit parameters, e.g. 1LL or 1ULL.


You can simply use NSString* s = [NSString stringWithFormat:@"dec:%i, hex:%x", 1, 1];

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜