How to convert hexadecimal string to decimal?

前端 未结 1 671
小鲜肉
小鲜肉 2021-01-26 00:15

I would appreciate it if you could tell me how I can convert hexadecimal letters within an NSString, e.g. @\"50A6C2\", to decimals using Objective-C. T

相关标签:
1条回答
  • 2021-01-26 00:37

    The easiest way is to use an NSScanner, specifically the methods scanHexInt: or scanHexLongLong:. Another possibility is to get the C string from the NSString and use C-style functions such as strtol (with base 16).

    0 讨论(0)
提交回复
热议问题