+ 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', '');