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

前端 未结 6 1174
悲哀的现实
悲哀的现实 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:26

    var words = new[] { "AL", "UR", "UN" };
    var arr = systemName.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Except(words);
    systemName = string.Join(" ", arr);
    

提交回复
热议问题