问题
I have (hopefully) a simple problem.
String.Insert(0, "test");
is not working, yet:
String.Text += "test";
does..? I need Insert so I can insert something in the middle of a string.
回答1:
I'm such an idiot, instant Google search fixed this.
String.Insert does not modify the string it is called on, but instead returns a new string with the inserted text in.
So I needed:
String = String.Insert(0, "test");
回答2:
it should work
see the below example
string names = "Romeo Juliet";
string shakespeare = names.Insert(6, "and ");
Console.WriteLine(shakespeare);
the result will be Romeo and Juliet
see the fiddle
来源:https://stackoverflow.com/questions/31216892/string-insert-not-working