-4
C#子串()不工作,它之前&符号停止:C#子串()停止在串符号
var name = "my_company_&_friends";
var sub = name.Substring(2);
// sub should be all string starting with symbol index 2
// sub should be "_company_&_friends"
// but it is "_company_"
这是一个错误?如何解决它?
你是怎么显示'sub'的?我只是在一个控制台应用程序中运行该代码以及一个'Console.WriteLine()',结果看起来很好。 – PakkuDon
我的心理调试技巧告诉我,你正在渲染到HTML并忘记逃生。 – SLaks
不能,不能重现它。 – Habib