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];
精彩评论