how to remove last comma in string variable android studio code example Example: remove last comma from string javascript str = str.replace(/,\s*$/, "");