开发者

datatype hexadecimal

开发者 https://www.devze.com 2023-01-31 04:31 出处:网络
Can Anybody help me in converting the string to hex value in OBJECTIVE C 开发者_开发知识库i have to pass the hex value to a macro...

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

精彩评论

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