Removing word or character from string followed by space or before space in c#

前端 未结 6 1222
悲哀的现实
悲哀的现实 2021-01-25 00:55

I have a string

string name = \"AL QADEER UR AL REHMAN AL KHALIL UN\";

How would I remove all characters AL, UR,

6条回答
  •  梦谈多话
    2021-01-25 01:20

    Try this please :

    var name = "AL QADEER UR AL REHMAN AL KHALIL UN";
    var list = new List { "AL", "UR", "UN" };
    name = string.Join(" ", name.Split(' ').ToList().Except(list));
    

提交回复
热议问题