How can I convert Int to UInt8 in Swift? Example. I want to convert number 22 to 0b00010110
var decimal = 22
var binary:UInt8 = ??? //What should I write here?
How can I convert Int to UInt8 in Swift? Example. I want to convert number 22 to 0b00010110
var decimal = 22
var binary:UInt8 = ??? //What should I write here?
I agree with the others, Although the for-loop seems redundant for repeating a character.
we can simply go with the following String initialiser:
usage example:
Here is a full example: