How to use regexp for finding patterns in strings?

后端 未结 2 766
眼角桃花
眼角桃花 2021-01-25 21:53

I have many patterns that want to find matched string in many string arrays and replace them with \"NON\" string. for example, if we have:

str[0]={\"this\",\"is\         


        
2条回答
  •  清歌不尽
    2021-01-25 22:21

    A one liner just for fun :]

    str = Array.ConvertAll(str, a => Array.ConvertAll(a, i => patterns.Contains(i) ? "NON" : i));
    

提交回复
热议问题