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
ManidManid 

removing string values

i have a string variable str
 
list<string> strAll=str.split(';');//str is string which contains list of ids as string separated by ;
//after some conditions i create a string variable 
string strs;//with some content of the strAll
i want to remove strs from the strAll any suggestions?
Steven NsubugaSteven Nsubuga
Simply call 
if (strAll.contains(strs)) {
    strAll.remove(strAll.indexOf(strs));
}

 
Raj VakatiRaj Vakati
Do you want to remove from the entire string ? 
 
strAll= strAll.substring(0,strAll.length()-5);

If you want to replace accross the entire string 
strAll= strAll.replace('strs', '');