c# string.replace in foreach loop

后端 未结 5 1719
长发绾君心
长发绾君心 2021-02-07 14:01

Somehow I can\'t seem to get string replacement within a foreach loop in C# to work. My code is as follows :

foreach (string s in names)
{
    s.Replace(\"pdf\"         


        
5条回答
  •  无人共我
    2021-02-07 14:35

    Why use replace, this will make the application slow. Use regex:

    http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.replace.aspx

提交回复
热议问题