function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GMASJGMASJ 

Remove or Trim the string

Hi, 

  I want to write a logic in case subject field to remove FW or RW starting character please suggest me how to implement. 

  Example :
  FW: Case for Testing = Should return only Case for Testing

  RW: Case for Testing = Should return only Case for Testing

Thanks
GMASJ
Bryan Leaman 6Bryan Leaman 6
I would probably do something like this:
String newsubject = case.subject.removeStartIgnoreCase('FW:').removeStartIgnoreCase('RW:').trim();
You could also just do a search/replace from anywhere in the string:
String newsubject = case.subject.replace('FW:', '').replace('RW:', '').trim();