Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Removing the last character from a String Using Salesforce Apex Class

Be First!

Removing the last character from a String Using Salesforce Apex Class

We can easyily remove the last character from a string by using the Substring() method using Apex Class
For Instance, If X is a string (TheBlogReaders.com) and the last 4 letter can be removed like below
Apex Class:

X = 'TheBlogReaders.com';
String Y = X.Substring(0,X.length()-4);

Result: TheBlogReaders

Another Example using “removeEnd”

How to remove the last letter or word using Apexclass

string strWebsite = 'TheBlogReaders.com,';
strWebsite = strWebsite.removeEnd(',');

Result: TheBlogReaders.com

(1255)

Previous
Next

Leave a Reply