I am using StringBuilder to show comma between records, but also getting comma at the end of Last Record
How to control on this ? I don't like to see comma at the end of last record - because it's useless
for (int i = 0; i < arrayList.size(); i++) {
String name = arrayList.get(i).getName();
int price = arrayList.get(i).getPrice();
stringBuilder.append(strName);
stringBuilder.append(" - "+price+",");
}
stringFinal = stringBuilder.toString();