c# - How to remove comma separated value from a string? -


i want remove comma separated value string..

suppose have string

string x="r, v, l, m" 

and want remove r above string, , reform string this

string x="v, l, m" 

from above string want remove value logic throw , reform string. should remove value , comma next , reform string...


the below specific code.. want remove value logic, want remove , comma next , reform string no empty space on deleted item.. how can achieve this?

offidcoll = my_order.customofferappliedonorder.trimend(','); if (offidcoll.split(',').contains(offerid.tostring())) {     // here want perform operation.    

}

tombala, applied doesn't work..it returns true

 if (!string.isnullorempty(my_order.customofferappliedonorder))                                 {                                     offidcoll = my_order.customofferappliedonorder.trimend(',');                                     if (offidcoll.split(',').contains(offerid.tostring()))                                     {                                         string x = string.join(",", offidcoll.split(new char[] { ',' },     stringsplitoptions.removeemptyentries).tolist().remove(offerid.tostring()));                                     }                                 }                             } 

just like:

list<string> items = x.split(",").select(i => i.trim()).where(i => != string.empty).tolist(); //split them , remove spaces items.remove("v"); //or whichever want string newx = string.join(", ", items.toarray()); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -