i tried to split a string looks like this
<a><b><c></c></b></a>
with java using the following code
String[] s =input.split("[<>]+");
System.out.println(Arrays.toString(s));
and this was the output
[, a, b, c, /c, /b, /a]
i don’t know what should i do to get rid of this empty string in the beginning of the resulting array.
any suggestions ?
There is an alternative method using regular expression matching:
Output:
[a, b, c, /c, /b, /a]