且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何替换字符串查询中的多个值

更新时间:2023-02-26 11:33:52

您已经有了解决方案.只需将Group 替换为Value.希望对您有帮助.
You already have the solution. Just replace the Group with your Value. Hope it will help you.
int i=0;
foreach (Match m in matches)
{
    System.Console.WriteLine(m.Groups[1]);
    //for (int i = 0; i <= m.Length; i++)
    {
       //ReplaceableValue = ReplaceableValue.Replace(m.Value.ToString(), array[i]);
       ReplaceableValue = ReplaceableValue.Replace(m.Groups[1].ToString(), array[i++]);
    }
}
System.Console.WriteLine(ReplaceableValue);