开发者

datatype hexadecimal

Can Anybody help me in converting the string to hex value in OBJECTIVE C

开发者_开发知识库

i have to pass the hex value to a macro... i have it in string like ---- 0xfffff how can i convert this string to hex and in what data type....


Use -[NSScanner scanHexLongLong:]:

NSString * s = @"0xFFFFF";
unsigned long long ull = 0;
NSScanner * scanner = [NSScanner scannerWithString:s];
[scanner scanHexLongLong:&ull];
NSLog(@"%llu", ull); //logs 1048575
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜