Boolean operations on strings

I am using Real Time Serial Read to read serial communication from an Arduino. I want to perform boolean operations on the received string for further processing, but it seems that Embed does not support direct boolean operations on strings. What should I do? Do I need to convert the string to binary first, or is there a faster way? If I need to convert the string to binary, how can I do that? Alternatively, are there any other better ways to perform boolean operations on strings?
Thank you for your response. It will be helpful to me.
Answers
-
You can use Boolean AND,OR,XOR directly with numeric strings. They will be converted to integers, then operated on in a bitwise manner. So this will work fine:
note that while single digit ones and zeros work as you would expect, 0x2 AND 0x1 = 0, since it is a bitwise operator. So 0x3 AND 0x1 =1
If you want to treat your numeric strings as zero vs non zero do this:
2 -
Can I perform bitwise operations directly on a string? For example, whether the received string is equal to "Hello", it may receive more than two different strings.
0