C# StringBuilder Insert(Int32, Char[]) Array

Description

StringBuilder Insert(Int32, Char[]) Inserts the string representation of a specified array of Unicode characters into this instance at the specified character position.

Syntax

StringBuilder.Insert(Int32, Char[]) has the following syntax.


public StringBuilder Insert(
  int index,
  char[] value
)

Parameters

StringBuilder.Insert(Int32, Char[]) has the following parameters.

  • index - The position in this instance where insertion begins.
  • value - The character array to insert.

Returns

StringBuilder.Insert(Int32, Char[]) method returns A reference to this instance after the insert operation has completed.

Example


using System;//from w ww  .ja v a 2s .co  m
using System.Text;

class Sample 
{
    public static void Main() 
    {
        StringBuilder sb = new StringBuilder("from java2s.com");
        sb.Insert(3, new char[]{'a'});
        Console.WriteLine(sb.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding