title: How to remove comma separated value from a string?
body: <p>I want to remove a comma separated value from the string..</p>
  
  <p>suppose I have a string like this </p>
  
  <pre><code>string x="r, v, l, m"
  </code></pre>
  
  <p>and i want to remove r from the above string, and reform the string like this</p>
  
  <pre><code>string x="v, l, m"
  </code></pre>
  
  <p>from the above string i want to remove any value that my logic throw and reform the string.
  it should remove the value and comma next to it and reform the string...</p>
  
  <hr>
  
  <p>The below is specific to my code..
  I want to remove any value that I get from the logic, I want to remove it and comma next to it and reform the string with no empty space on the deleted item.. How can I achieve this?</p>
  
  <pre><code>offIdColl = my_Order.CustomOfferAppliedonOrder.TrimEnd(',');
  if (offIdColl.Split(',').Contains(OfferID.ToString()))
  {
      // here i want to perform that operation.   
  </code></pre>
  
  <h2>    }</h2>
  
  <p>Tombala, i applied it like this but it doesn't work..it returns true</p>
  
  <pre><code> 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()));
                                      }
                                  }
                              }
  </code></pre>