How to remove comma separated value from a string?

后端 未结 10 1856
你的背包
你的背包 2021-01-03 00:13

I want to remove a comma separated value from the string..

suppose I have a string like this

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

and i want to

10条回答
  •  轮回少年
    2021-01-03 00:55

    public void string Remove(string allStuff, string whatToRemove)
    {
      StringBuilder returnString = new StringBuilder();
      string[] arr = allStuff.Split('');
       foreach (var item in arr){
         if(!item.Equals(whatToRemove)){
         returnString.Append(item);
         returnString.Append(", "); 
        }
       }
      return returnString.ToString();
    }
    

提交回复
热议问题