In my application I am storing string type data in arraylist with "|" operator as separator. i.e my array-list contains data like [|123,124,|,324,543|789,649,666,356] Now I need to split the arraylist with "|" and need to store the data into a string array. How can I do that?
My Code:
ArrayList<String> arr2;
ArrayList<ArrayList<String>> alllist;
String[] str;
for (j = 0; j < alllist.size(); j++) {
arr2 = new ArrayList<String>();
arr2 = alllist.get(j);
for (Object v : arr2) {
str = v.toString().split("|");
System.out.println("checking str[i]"+str[i]);
if (str[j].contains(",")) {
System.out.println("hii");
}
}
It is showing error at if(str[j].contains(","))
line....Please help me regarding this..
thanks in advance...
i
? – hmjd Mar 19 '12 at 13:55