I want a String[]
that shows this:
Value1: [0, 0, 0, 0, 0, 0, 0, 1]
But when I use String[] b1 = sByte.split("");
, I get
Value1: [, 0, 0, 0, 0, 0, 0, 0, 1]
That extra position isn't supposed to be there. Is there any way to remove it?
I want a String[]
that shows this:
Value1: [0, 0, 0, 0, 0, 0, 0, 1]
But when I use String[] b1 = sByte.split("");
, I get
Value1: [, 0, 0, 0, 0, 0, 0, 0, 1]
That extra position isn't supposed to be there. Is there any way to remove it?
You can split it on a location that is both preceded by and followed by any character:
String[] b1 = sByte.split("(?<=[\\s\\S])(?=[\\s\\S])");