I have a string value where I am getting the a comma with }
I want to remove the last ,
I have tried below but it is not working.
String str = '{johny:[1,2,3,4,5],erich:[5,6,7,8,9],}';
system.debug('strValue: ' + str.Substring(str.length()-2));
or tried this:
system.debug('strValue: ' + str.substring(1,str.length()-1););
result should be like this (without comma at the end):
String str = '{johny:[1,2,3,4,5],erich:[5,6,7,8,9]}';
Best Answer
yields