Last active
December 24, 2015 05:44
-
-
Save el-hoshino/4d03dbed91fadaee2dd6 to your computer and use it in GitHub Desktop.
十六進数の文字列から実際の数値を取得する ref: http://qiita.com/lovee/items/eac017d1dcaf52541d3d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let hexString = "FF" | |
var hex:UInt32 = 0x0 | |
let scanner:NSScanner = NSScanner(string: hexString) | |
scanner.scanHexInt(&hex) | |
print(hex) //255 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let hexString = "FF" | |
let hex = Int(hexString, radix: 16) ?? 0 | |
print(hex) //255 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment