I can easily turn a decimal number into an octal but I'm trying to do the reverse and I've got stuck.
let decimal = 11_224_393
let octString = String(rawAddress, radix: 8, uppercase: false)
let octal = octString.toInt()
Question
I want a function that given an Int of octal digits will read it in as an octal and convert it to decimal
such as:
// oct2dec(777) = 511
// oct2dec(10) = 8
func oct2dec(octal : Int) -> Int {
// what goes here?
}