I'm having main method arguments separated by commas and some of the values might have white spaces also, I have to split only comma separated values ignoring whitespaces.
eg: abcdef,xyzert,mnop qrst
I have tried using split(",")
but it's giving me 4 values instead of 3 as the last element should be treated as one element.
Here's my code:
public class ArgCheck {
public static void main(String [] args) {
String x = Arrays.toString(args);
System.out.println(x);
String [] y = x.split(",");
System.out.println(y.length);
}
}
Please help