String.Insert(int index, String value) : String « System « C# / C Sharp by API






String.Insert(int index, String value)

   

using System;

class MainClass
{

  public static void Main()
  {
    string[] myStrings = {"To", "be", "or", "not", "to", "be"};
    string myString = String.Join(".", myStrings);   
    
    string myString10 = myString.Insert(6, "A, ");
    Console.WriteLine("myString.Insert(6, \"A, \") = " + myString10);
    string myString11 = myString10.Remove(14, 7);
    Console.WriteLine("myString10.Remove(14, 7) = " + myString11);
    string myString12 = myString11.Replace(',', '?');
    Console.WriteLine("myString11.Replace(',', '?') = " + myString12);
    string myString13 = myString12.Replace("to be", "Or not to be A");
    Console.WriteLine("myString12.Replace(\"to be\", \"Or not to be A\") = " + myString13);
  }

}

   
    
    
  








Related examples in the same category

1.new String(char[] charArray)
2.String == String
3.String.Compare(String value1, String value2)
4.String.Compare(String value1, String value2, boolean case)
5.String.Concat(String value1, String value2)
6.String.Contains
7.String.Copy(String value)
8.String.Empty
9.String.EndsWith()
10.String.Equals(String aString)
11.String.Format(String format, Float aFloat);
12.String.IndexOf
13.String.IndexOfAny(char[] myChars)
14.String.Join(String join, String value)
15.String.LastIndexOf
16.String.LastIndexOfAny(char[] myChars)
17.String.Length
18.String.PadLeft(int len)
19.String.PadLeft(int len, char ch)
20.String.PadRight(int len)
21.String.PadRight(int len, char ch)
22.String.Remove(int start, int end)
23.String.Replace(char ch, char ch2)
24.String.Replace(String value1, String value2)
25.String.Split(String splittor)
26.String.StartsWith()
27.String.SubString(int pos)
28.String.SubString(int start,)
29.String.ToCharArray
30.String.ToCharArray(int start,)
31.String.ToLower()
32.String.ToUpper()
33.String.Trim()
34.String.TrimEnd()
35.String.TrimStart()