You just need to use String.Remove
and String.Insert
method like;
string text = "abcdefghijklmnopqrstuvwxyz";
if(text.Length > "hello world".Length + 3)
{
text = text.Remove(3, "hello world".Length).Insert(3, "hello world");
Console.WriteLine(text);
}
Output will be;
abchello worldopqrstuvwxyz
Here a DEMO.
Remember, strings are immutable types in .NET. You can't change them. Even if you think you change them, you actually create a new string objects.
If you want to work with mutable strings, take a look at StringBuilder
class.
This class represents a string-like object whose value is a mutable
sequence of characters. The value is said to be mutable because it can
be modified once it has been created by appending, removing,
replacing, or inserting characters.