How to get last 10 numbers from a String using Apex in Salesforce ?

Latest Posts Forums Superbadges Help and Discussions How to get last 10 numbers from a String using Apex in Salesforce ?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1438 Reply
    Admin
    Keymaster

    We can use right(n) command to get last n digits from a String using Apex.

    Syntax:
    str.right(n);

    Example:
    String strphoneNumber = ‘917718838553’;
    string phnumber = strphoneNumber.right(10);
    string phonewithCode = ’91’+strphoneNumber.right(10);

Viewing 1 post (of 1 total)
Reply To: How to get last 10 numbers from a String using Apex in Salesforce ?
Your information: