using System; namespace String_Insert { class Program { static void Main( string [] args ) { string interesting = "This is interesting"; var veryInteresting = interesting.Insert( 8, "very " ); Console.WriteLine( interesting ); Console.WriteLine( veryInteresting ); } } }
We start off in line 8 creating a string and then in line 10 we insert the word "very " into that string using the Insert() method of the interesting object. This returns a new string with the words "This is very interesting".
No comments:
Post a Comment