Skip to content

Instantly share code, notes, and snippets.

@ericdke
Created January 18, 2016 15:44
Show Gist options
  • Save ericdke/a15e6504eefabc8c7859 to your computer and use it in GitHub Desktop.
Save ericdke/a15e6504eefabc8c7859 to your computer and use it in GitHub Desktop.
let binNum = 42
let binStr = String(binNum, radix: 2)
print(binStr)
let octNum = 42
let octStr = String(octNum, radix: 8)
print(octStr)
let hexNum = 42
let hexStr = String(hexNum, radix: 16)
print(hexStr)
let b = Int(0b101010)
print(b)
let o = Int(0o52)
print(o)
let h = Int(0x2a)
print(h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment