How do I replace part of a string in C#?

前端 未结 5 900
旧时难觅i
旧时难觅i 2020-12-10 20:40

Supposed I have the following string:

string str = \"text\";

And I would like to change \'tag\' to \'newTag\' so the

5条回答
  •  情话喂你
    2020-12-10 20:52

    string str = "text";
    string newValue = new XElement("newTag", XElement.Parse(str).Value).ToString();
    

提交回复
热议问题