首页 新闻 会员 周边

C#字符串添加

0
悬赏园豆:5 [已解决问题] 解决于 2013-06-05 16:08

原先字符串

<TireSize>195/55R15 花纹CPC2</TireSize>
  <AveragePrice>680</AveragePrice>
  <MonthlyTireVolume>4</MonthlyTireVolume>


  <TireSize>265/65R17 花纹LX</TireSize>
  <AveragePrice>1380</AveragePrice>
   <MonthlyTireVolume>2</MonthlyTireVolume>

需要效果

<TireSize>

<TireSize>195/55R15 花纹CPC2</TireSize>
  <AveragePrice>680</AveragePrice>
  <MonthlyTireVolume>4</MonthlyTireVolume>

</TireSize>

 

<TireSize>
  <TireSize>265/65R17 花纹LX</TireSize>
  <AveragePrice>1380</AveragePrice>
   <MonthlyTireVolume>2</MonthlyTireVolume>

</TireSize>

新麦穗的主页 新麦穗 | 初学一级 | 园豆:82
提问于:2013-06-03 14:43
< >
分享
最佳答案
0

看起来就是<TireSize>节点没有结束,是吧?

可以采用直接替换的方式实现:

sourceString.Replace("</MonthlyTireVolume>","</MonthlyTireColume></TireSize>")

类似于这样的代码。

收获园豆:3
幻天芒 | 高人七级 |园豆:37175 | 2013-06-05 09:45
其他回答(1)
0

这样有规则的可以当做节点去操作

收获园豆:2
骷髅人 | 园豆:464 (菜鸟二级) | 2013-06-03 16:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册