Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
1 answer
  1. Jan 5, 2018, 3:51 PM
    Returns a new String that begins with the character at the specified zero-based startIndex and extends to the character at endIndex - 1

    In your case, you are populating account's contact name with very first string from contactNames and trimming the last character from returned string.  

     

    For example 

    String str = 'SLA-UPsdfdsfdsfG-4HR-4ON';

    String res = str.substring(0, str.length()-1);

    system.debug('Your String---'+res);

    You will get the result like this SLA-UPsdfdsfdsfG-4HR-4O

     
0/9000