Wednesday, April 18, 2012

How to split the array values and store in a string in android?

I am getting the values from arraylist arr and storing those values in a string with comma separator. But for the last value also comma is adding. How can I remove that? Please help me...



My Code:



ArrayList<String> arr;  
String str;

for (int i = 0; i < arr.size(); i++) {

int kk = arr.size();
System.out.println("splitting test" + arr.get(i));
str += arr.get(i) + ",";

System.out.println("result" + str);


}




No comments:

Post a Comment