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:
"1" then you would write "1" to the output string, otherwise you would write "0". Iterating both strings at the same time can be achieved with zip assuming both input strings are the same length.