How to remove last character from a String using Salesforce Apex?

How to remove last character from a String using Salesforce Apex?

removeEnd() can be used to remove the last character from a String in Salesforce Apex.

Sample Code:

String str = 'Approved/Rejected/';
str = str.removeEnd('/');
system.debug('Value is ' + str);

Output:

Leave a Reply