I got String from the database which have multiple commas (,) . I want to remove the last comma but I can\'t really find a simple way of doing it.
,
You can try with this, it worked for me:
if (names.endsWith(",")) { names = names.substring(0, names.length() - 1); }
Or you can try with this too:
string = string.replaceAll(", $", "");