Activity Forums Salesforce® Discussions remove single quotes and ' , ' from the end of string in Salesforce trigger?

  • remove single quotes and ' , ' from the end of string in Salesforce trigger?

    Posted by Anuj on May 27, 2020 at 2:17 pm

    How can we remove single quotes and this ' , ' from the end of string in trigger in Salesforce?

    Shweta replied 4 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Shweta

    Member
    May 27, 2020 at 2:34 pm

    Here is the Sample code which you can use to remove the ',' if there is any at the end of your string.
    string teststring = 'Myteststring,' ;
    if(teststring.endsWith(','))

    {teststring= teststring.substring(0,teststring.length()-1);
    system.debug('@@@' + teststring);
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos