Tuesday, December 22, 2015

How to remove last character from a String in Apex?

String body= '{"userID" : "115f0000001i1gu"}';
String finalBody= body.removeEnd('}');
system.debug('Value is ' + finalBody);
output: {"userID" : "115f0000001i1gu"

No comments:

Post a Comment