<EndTest Title="GetLoggerTest" TUID="" Result="Fail" Repro="" CA="1005976492" LA="1008475784">
  <rti id="3805221601" />
  <ctx id="1526293091" />
</EndTest>
<rti id="3805221601" />
<ctx id="1526293091" />string nn;上面的字符赋值给nn我要获得
<EndTest Title="GetLoggerTest" TUID="" Result="Fail" Repro="" CA="1005976492" LA="1008475784">
  <rti id="3805221601" />
  <ctx id="1526293091" />
</EndTest>

解决方案 »

  1.   

    用正则表达式,删除</EndTest>后内容
      

  2.   

    你的字符串里面没有回车的话就用
    <EndTest.*</EndTest>匹配你要得到的数据吧.
      

  3.   

                                string content = nn;
                                content = content.Substring(content.LastIndexOf("</EndTest>" + 1));
                                textBox1.AppendText(content + "\r\n");
    我这么做报错了...