Get last n digits from a String using Apex in Salesforce

right() is used to get last n digits from a String using Apex.

Here is an example:

String str = 'biswajeet';
String result = str.right(4); //returns jeet

Leave a Reply