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.
,
For more than one commas
String names = "Hello,World,,,"; System.out.println(names.replaceAll("(,)*$", ""));
Output: Hello,World