I want the split a string but also keep the null value. For example, I have a string like this:
String x = "x,y";
String result[] = y.split(",");
// then i will get result like this:
//result[] = ["x","y"]
But if I have a string like this:
String y = "x,";
String result[]=y.split(",");
//i will get something thing like this:
//result[] = ["x"]
I want the keep the null value as well. Is it possible for me to get a result like this: result[]=["x",""]
using the split
method?