本帖最后由 Star 于 2011-2-22 11:08 编辑 8 e8 {: z$ ~ @4 V; ~+ |" W% K, Z; x2 m7 [8 C) J& Z1 m1 Q* W
这一久在给EB_EXP debug,有个地方需要对字符串进行Insert处理,原来的程序是这样写的:
$ [' ~ v& @+ D7 g! [) l
result.Insert(result.IndexOf("</p>"), " (单位:分钟)");- L, n5 i( p5 m, u
复制代码
调试过程中,发现返回的这个result的值没有改变,仍然是执行Insert操作之前的值,于是去网上查,MSDN(http://msdn.microsoft.com/en-us/library/system.string.insert.aspx)上有一条注意说明: e& |: M: R a2 n9 g8 E! O2 Y Note , b+ x5 [9 u" G+ [' k This method does not modify the value of the current instance. Instead, it returns a new string in which value is inserted into the current instance.3 Q# N. c. a0 V' f6 w6 I