本文介绍了在字符串数组的每个元素中替换子字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,我有一个字符串数组,我想替换每个这些元素中的某个子字符串.除了显式地迭代数组之外,还有一种简便的方法吗?
Hey, I have an array of strings and I want to replace a certain substring in each of those elements. Is there an easy way to do that besides iterating the array explicitly?
谢谢:-)
推荐答案
您可以隐式迭代数组
arrayOfStrings = arrayOfStrings.Select(s => s.Replace("abc", "xyz")).ToArray();
这篇关于在字符串数组的每个元素中替换子字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!