result.Insert(result.IndexOf("</p>"), " (单位:分钟)"); " Y5 f. r% d0 x: |
复制代码
调试过程中,发现返回的这个result的值没有改变,仍然是执行Insert操作之前的值,于是去网上查,MSDN(http://msdn.microsoft.com/en-us/library/system.string.insert.aspx)上有一条注意说明:- L3 k/ S& t# W3 s( V2 Q- T
Note 7 i( |9 i# r/ N* b0 D5 @ 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.! n; V# b z2 p+ @. ?: i2 L' M5 ]3 T