I need to do bitwise OR of two binary strings.
For example, if the binary strings are "110001" and "101101", then I need the result as "111101".
How can I do this in Swift ?
I need to do bitwise OR of two binary strings.
For example, if the binary strings are "110001" and "101101", then I need the result as "111101".
How can I do this in Swift ?
You can convert it first into Int
let a = Int("110001", radix: 2)!
let b = Int("101101", radix: 2)!
let c = a | b
let stringResult = String(c, radix: 2, uppercase: false)
More info: