I have a string variable which looks something like this: fasdhkfsdk, 1 sdfs
The amount of front and back characters in the string will differe in size, but the comma and the binary value will always be there (the value will change from 1 to 0).
I need a way to chop everything left and right of the binary value off and leave only the 1 or 0. The amount of characters on both sides do change, so I don’t think that I can use substr or explode, but I could be wrong
Thanks very much
p.s. Yes, there will always be a comma and a space before the binary digit
you can use regex like this:
that will remove everything but 0’s and 1’s, if you’re sure the string will only be characters from the alphabet