StringBuilder.Insert 메서드

정의

지정된 개체의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

오버로드

Insert(Int32, String)

문자열을 지정한 인덱스에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Single)

단정밀도 부동 소수점 숫자의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, UInt16)

부호 없는 16비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Int16)

지정된 16비트 부호 있는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, UInt64)

부호 없는 64비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, String, Int32)

지정된 하나 이상의 문자열의 복사본을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Char[], Int32, Int32)

유니코드 문자의 지정된 하위 배열에 대한 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, SByte)

지정된 8비트 부호 있는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, UInt32)

부호 없는 32비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, ReadOnlySpan<Char>)

문자 시퀀스를 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Double)

배정밀도 부동 소수점 숫자의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Int64)

부호 있는 64비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Int32)

지정된 32비트 부호 있는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Object)

개체의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Decimal)

10진수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Char[])

지정된 유니코드 문자 배열의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Char)

지정된 유니코드 문자의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Byte)

지정된 8비트 부호 없는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

Insert(Int32, Boolean)

지정된 문자 위치에 있는 이 인스턴스에 부울 값의 문자열 표현을 삽입합니다.

예제

다음 예제는 Insert 메서드.

using namespace System;
using namespace System::Text;
ref class Sample
{
private:

   //                           index: 012345
   static String^ initialValue = "--[]--";
   static StringBuilder^ sb;

public:
   static void Main()
   {
      String^ xyz = "xyz";
      array<Char>^abc = {'a','b','c'};
      Char star = '*';
      Object^ obj = 0;
      bool xBool = true;
      Byte xByte = 1;
      short xInt16 = 2;
      int xInt32 = 3;
      long xInt64 = 4;
      Decimal xDecimal = 5;
      float xSingle = 6.6F;
      double xDouble = 7.7;
      
      // The following types are not CLS-compliant.
      UInt16 xUInt16 = 8;
      UInt32 xUInt32 = 9;
      UInt64 xUInt64 = 10;
      SByte xSByte = -11;
      
      //
      Console::WriteLine( "StringBuilder.Insert method" );
      sb = gcnew StringBuilder( initialValue );
      sb->Insert( 3, xyz, 2 );
      Show( 1, sb );
      sb->Insert( 3, xyz );
      Show( 2, sb );
      sb->Insert( 3, star );
      Show( 3, sb );
      sb->Insert( 3, abc );
      Show( 4, sb );
      sb->Insert( 3, abc, 1, 2 );
      Show( 5, sb );
      sb->Insert( 3, xBool ); // True
      Show( 6, sb );
      sb->Insert( 3, obj ); // 0
      Show( 7, sb );
      sb->Insert( 3, xByte ); // 1
      Show( 8, sb );
      sb->Insert( 3, xInt16 ); // 2
      Show( 9, sb );
      sb->Insert( 3, xInt32 ); // 3
      Show( 10, sb );
      sb->Insert( 3, xInt64 ); // 4
      Show( 11, sb );
      sb->Insert( 3, xDecimal ); // 5
      Show( 12, sb );
      sb->Insert( 3, xSingle ); // 6.6
      Show( 13, sb );
      sb->Insert( 3, xDouble ); // 7.7
      Show( 14, sb );
      
      // The following Insert methods are not CLS-compliant.
      sb->Insert( 3, xUInt16 ); // 8
      Show( 15, sb );
      sb->Insert( 3, xUInt32 ); // 9
      Show( 16, sb );
      sb->Insert( 3, xUInt64 ); // 10
      Show( 17, sb );
      sb->Insert( 3, xSByte ); // -11
      Show( 18, sb );
      
      //
   }

   static void Show( int overloadNumber, StringBuilder^ sbs )
   {
      Console::WriteLine( "{0,2:G} = {1}", overloadNumber, sbs );
      sb = gcnew StringBuilder( initialValue );
   }

};

int main()
{
   Sample::Main();
}

/*
This example produces the following results:

StringBuilder.Insert method
 1 = --[xyzxyz]--
 2 = --[xyz]--
 3 = --[*]--
 4 = --[abc]--
 5 = --[bc]--
 6 = --[True]--
 7 = --[0]--
 8 = --[1]--
 9 = --[2]--
10 = --[3]--
11 = --[4]--
12 = --[5]--
13 = --[6.6]--
14 = --[7.7]--
15 = --[8]--
16 = --[9]--
17 = --[10]--
18 = --[-11]--

*/
using System;
using System.Text;

class Sample
{
//                         index: 012345
    static string initialValue = "--[]--";
    static StringBuilder sb;

    public static void Main()
    {
    string      xyz       = "xyz";
    char[]      abc       = {'a', 'b', 'c'};
    char        star      = '*';
    Object 	obj       = 0;

    bool        xBool     = true;
    byte        xByte     = 1;
    short       xInt16    = 2;
    int         xInt32    = 3;
    long        xInt64    = 4;
    Decimal     xDecimal  = 5;
    float       xSingle   = 6.6F;
    double      xDouble   = 7.7;

// The following types are not CLS-compliant.
    ushort      xUInt16   = 8;
    uint        xUInt32   = 9;
    ulong       xUInt64   = 10;
    sbyte       xSByte    = -11;
//
    Console.WriteLine("StringBuilder.Insert method");
    sb = new StringBuilder(initialValue);

    sb.Insert(3, xyz, 2);
    Show(1, sb);

    sb.Insert(3, xyz);
    Show(2, sb);

    sb.Insert(3, star);
    Show(3, sb);

    sb.Insert(3, abc);
    Show(4, sb);

    sb.Insert(3, abc, 1, 2);
    Show(5, sb);

    sb.Insert(3, xBool);     // True
    Show(6, sb);

    sb.Insert(3, obj);       // 0
    Show(7, sb);

    sb.Insert(3, xByte);     // 1
    Show(8, sb);

    sb.Insert(3, xInt16);    // 2
    Show(9, sb);

    sb.Insert(3, xInt32);    // 3
    Show(10, sb);

    sb.Insert(3, xInt64);    // 4
    Show(11, sb);

    sb.Insert(3, xDecimal);  // 5
    Show(12, sb);

    sb.Insert(3, xSingle);   // 6.6
    Show(13, sb);

    sb.Insert(3, xDouble);   // 7.7
    Show(14, sb);

// The following Insert methods are not CLS-compliant.
    sb.Insert(3, xUInt16);   // 8
    Show(15, sb);

    sb.Insert(3, xUInt32);   // 9
    Show(16, sb);

    sb.Insert(3, xUInt64);   // 10
    Show(17, sb);

    sb.Insert(3, xSByte);    // -11
    Show(18, sb);
//
    }

    public static void Show(int overloadNumber, StringBuilder sbs)
    {
    Console.WriteLine("{0,2:G} = {1}", overloadNumber, sbs.ToString());
    sb = new StringBuilder(initialValue);
    }
}
/*
This example produces the following results:

StringBuilder.Insert method
 1 = --[xyzxyz]--
 2 = --[xyz]--
 3 = --[*]--
 4 = --[abc]--
 5 = --[bc]--
 6 = --[True]--
 7 = --[0]--
 8 = --[1]--
 9 = --[2]--
10 = --[3]--
11 = --[4]--
12 = --[5]--
13 = --[6.6]--
14 = --[7.7]--
15 = --[8]--
16 = --[9]--
17 = --[10]--
18 = --[-11]--

*/
open System.Text

let initialValue = "--[]--"

let show overloadNumber (sbs: StringBuilder) =
    printfn $"{overloadNumber, 2:G} = {sbs}"
    sbs.Clear().Append initialValue |> ignore

let xyz = "xyz"
let abc = [| 'a'; 'b'; 'c' |]
let star = '*'
let obj: obj = 0

let xBool = true
let xByte = 1uy
let xInt16 = 2s
let xInt32 = 3
let xInt64 = 4L
let xDecimal = 5M
let xSingle = 6.6f
let xDouble = 7.7

// The following types are not CLS-compliant.
let xUInt16 = 8us
let xUInt32 = 9u
let xUInt64 = 10uL
let xSByte = -11y

printfn "StringBuilder.Insert method"
let sb = StringBuilder initialValue

sb.Insert(3, xyz, 2) |> ignore
show 1 sb

sb.Insert(3, xyz) |> ignore
show 2 sb

sb.Insert(3, star) |> ignore
show 3 sb

sb.Insert(3, abc) |> ignore
show 4 sb

sb.Insert(3, abc, 1, 2) |> ignore
show 5 sb

sb.Insert(3, xBool) |> ignore // True
show 6 sb

sb.Insert(3, obj) |> ignore // 0
show 7 sb

sb.Insert(3, xByte) |> ignore // 1
show 8 sb

sb.Insert(3, xInt16) |> ignore // 2
show 9 sb

sb.Insert(3, xInt32) |> ignore // 3
show 10 sb

sb.Insert(3, xInt64) |> ignore // 4
show 11 sb

sb.Insert(3, xDecimal) |> ignore // 5
show 12 sb

sb.Insert(3, xSingle) |> ignore // 6.6
show 13 sb

sb.Insert(3, xDouble) |> ignore // 7.7
show 14 sb

// The following Insert methods are not CLS-compliant.
sb.Insert(3, xUInt16) |> ignore // 8
show 15 sb

sb.Insert(3, xUInt32) |> ignore // 9
show 16 sb

sb.Insert(3, xUInt64) |> ignore // 10
show 17 sb

sb.Insert(3, xSByte) |> ignore // -11
show 18 sb

// This example produces the following results:
//       StringBuilder.Insert method
//        1 = --[xyzxyz]--
//        2 = --[xyz]--
//        3 = --[*]--
//        4 = --[abc]--
//        5 = --[bc]--
//        6 = --[True]--
//        7 = --[0]--
//        8 = --[1]--
//        9 = --[2]--
//       10 = --[3]--
//       11 = --[4]--
//       12 = --[5]--
//       13 = --[6.6]--
//       14 = --[7.7]--
//       15 = --[8]--
//       16 = --[9]--
//       17 = --[10]--
//       18 = --[-11]--
Imports System.Text

Class Sample
   '                                 index: 012345
   Private Shared initialValue As String = "--[]--"
   Private Shared sb As StringBuilder
   
   Public Shared Sub Main()
      Dim xyz As String = "xyz"
      Dim abc As Char() =  {"a"c, "b"c, "c"c}
      Dim star As Char = "*"c
      Dim obj As [Object] = 0
      
      Dim xBool As Boolean = True
      Dim xByte As Byte = 1
      Dim xInt16 As Short = 2
      Dim xInt32 As Integer = 3
      Dim xInt64 As Long = 4
      Dim xDecimal As [Decimal] = 5
      Dim xSingle As Single = 6.6F
      Dim xDouble As Double = 7.7
      
      ' The following types are not CLS-compliant.
      ' Dim xUInt16 As System.UInt16 = 8 
      ' Dim xUInt32 As System.UInt32 = 9
      ' Dim xUInt64 As System.UInt64 = 10 
      ' Dim xSByte As System.SByte = - 11
      '
      Console.WriteLine("StringBuilder.Insert method")
      sb = New StringBuilder(initialValue)
      
      sb.Insert(3, xyz, 2)
      Show(1, sb)
      
      sb.Insert(3, xyz)
      Show(2, sb)
      
      sb.Insert(3, star)
      Show(3, sb)
      
      sb.Insert(3, abc)
      Show(4, sb)
      
      sb.Insert(3, abc, 1, 2)
      Show(5, sb)
      
      sb.Insert(3, xBool)     ' True
      Show(6, sb)
      
      sb.Insert(3, obj)       ' 0
      Show(7, sb)
      
      sb.Insert(3, xByte)     ' 1
      Show(8, sb)
      
      sb.Insert(3, xInt16)    ' 2
      Show(9, sb)
      
      sb.Insert(3, xInt32)    ' 3
      Show(10, sb)
      
      sb.Insert(3, xInt64)    ' 4
      Show(11, sb)
      
      sb.Insert(3, xDecimal)  ' 5
      Show(12, sb)
      
      sb.Insert(3, xSingle)   ' 6.6
      Show(13, sb)
      
      sb.Insert(3, xDouble)   ' 7.7
      Show(14, sb)
      
      ' The following Insert methods are not CLS-compliant.
      ' sb.Insert(3, xUInt16) ' 8
      ' sb.Insert(3, xUInt32) ' 9
      ' sb.Insert(3, xUInt64) ' 10
      ' sb.Insert(3, xSByte)  ' -11

   End Sub
   
   Public Shared Sub Show(overloadNumber As Integer, sbs As StringBuilder)
      Console.WriteLine("{0,2:G} = {1}", overloadNumber, sbs.ToString())
      sb = New StringBuilder(initialValue)
   End Sub
End Class
'
'This example produces the following results:
'
'StringBuilder.Insert method
' 1 = --[xyzxyz]--
' 2 = --[xyz]--
' 3 = --[*]--
' 4 = --[abc]--
' 5 = --[bc]--
' 6 = --[True]--
' 7 = --[0]--
' 8 = --[1]--
' 9 = --[2]--
'10 = --[3]--
'11 = --[4]--
'12 = --[5]--
'13 = --[6.6]--
'14 = --[7.7]--
'

Insert(Int32, String)

문자열을 지정한 인덱스에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::String ^ value);
public System.Text.StringBuilder Insert (int index, string value);
public System.Text.StringBuilder Insert (int index, string? value);
member this.Insert : int * string -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As String) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
String

삽입할 문자열입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스의 현재 길이보다 큽니다.

또는

StringBuilder 개체의 현재 길이에 value의 길이를 더한 값이 MaxCapacity보다 큽니다.

설명

기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 용량은 필요에 따라 조정됩니다.

이 instance StringBuilder 가 이거나 value 가 아닌 경우 valuenull변경되지 않지만 null 길이는 0입니다.

추가 정보

적용 대상

Insert(Int32, Single)

단정밀도 부동 소수점 숫자의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, float value);
public System.Text.StringBuilder Insert (int index, float value);
member this.Insert : int * single -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Single) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Single

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Single.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, UInt16)

중요

이 API는 CLS 규격이 아닙니다.

부호 없는 16비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::UInt16 value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Insert (int index, ushort value);
[<System.CLSCompliant(false)>]
member this.Insert : int * uint16 -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As UShort) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
UInt16

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

특성

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

UInt16.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, Int16)

지정된 16비트 부호 있는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, short value);
public System.Text.StringBuilder Insert (int index, short value);
member this.Insert : int * int16 -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Short) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Int16

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Int16.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, UInt64)

중요

이 API는 CLS 규격이 아닙니다.

부호 없는 64비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::UInt64 value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Insert (int index, ulong value);
[<System.CLSCompliant(false)>]
member this.Insert : int * uint64 -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As ULong) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
UInt64

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

특성

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

UInt64.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, String, Int32)

지정된 하나 이상의 문자열의 복사본을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::String ^ value, int count);
public System.Text.StringBuilder Insert (int index, string value, int count);
public System.Text.StringBuilder Insert (int index, string? value, int count);
member this.Insert : int * string * int -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As String, count As Integer) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
String

삽입할 문자열입니다.

count
Int32

value를 삽입할 횟수입니다.

반환

삽입 작업이 완료한 후에 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스의 현재 길이보다 큽니다.

또는

count가 0보다 작은 경우

StringBuilder 개체의 현재 길이에 value의 길이를 더한 다음 count를 곱한 값이 MaxCapacity보다 큽니다.

설명

기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

가 이 아닌 경우 nullvaluevalueStringBuilder 개체는 변경되지 않지만 null 길이는 0이거나 count 0입니다.

추가 정보

적용 대상

Insert(Int32, Char[], Int32, Int32)

유니코드 문자의 지정된 하위 배열에 대한 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, cli::array <char> ^ value, int startIndex, int charCount);
public System.Text.StringBuilder Insert (int index, char[] value, int startIndex, int charCount);
public System.Text.StringBuilder Insert (int index, char[]? value, int startIndex, int charCount);
member this.Insert : int * char[] * int * int -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Char(), startIndex As Integer, charCount As Integer) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Char[]

문자 배열입니다.

startIndex
Int32

value 내의 시작 인덱스입니다.

charCount
Int32

삽입할 문자 수입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

valuenull이고 startIndexcharCount는 0이 아닙니다.

index, startIndex 또는 charCount가 0보다 작습니다.

또는

index가 이 인스턴스의 길이보다 큽니다.

또는

startIndex+charCountvalue 내의 위치가 아닙니다.

또는

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

적용 대상

Insert(Int32, SByte)

중요

이 API는 CLS 규격이 아닙니다.

지정된 8비트 부호 있는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::SByte value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Insert (int index, sbyte value);
[<System.CLSCompliant(false)>]
member this.Insert : int * sbyte -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As SByte) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
SByte

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

특성

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

SByte.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, UInt32)

중요

이 API는 CLS 규격이 아닙니다.

부호 없는 32비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::UInt32 value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Insert (int index, uint value);
[<System.CLSCompliant(false)>]
member this.Insert : int * uint32 -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As UInteger) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
UInt32

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

특성

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

UInt32.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, ReadOnlySpan<Char>)

문자 시퀀스를 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, ReadOnlySpan<char> value);
public System.Text.StringBuilder Insert (int index, ReadOnlySpan<char> value);
member this.Insert : int * ReadOnlySpan<char> -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As ReadOnlySpan(Of Char)) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
ReadOnlySpan<Char>

삽입할 문자 범위입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

설명

기존 문자는 의 문자 시퀀스가 value 삽입할 공간을 확보하기 위해 이동됩니다. 용량은 필요에 따라 조정됩니다.

적용 대상

Insert(Int32, Double)

배정밀도 부동 소수점 숫자의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, double value);
public System.Text.StringBuilder Insert (int index, double value);
member this.Insert : int * double -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Double) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Double

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Double.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, Int64)

부호 있는 64비트 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, long value);
public System.Text.StringBuilder Insert (int index, long value);
member this.Insert : int * int64 -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Long) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Int64

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Int64.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, Int32)

지정된 32비트 부호 있는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, int value);
public System.Text.StringBuilder Insert (int index, int value);
member this.Insert : int * int -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Integer) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Int32

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Int32.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, Object)

개체의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::Object ^ value);
public System.Text.StringBuilder Insert (int index, object value);
public System.Text.StringBuilder Insert (int index, object? value);
member this.Insert : int * obj -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Object) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Object

삽입할 개체이거나 null입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Object.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

가 이nullvalue 이 instance 값이 변경되지 않습니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, Decimal)

10진수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::Decimal value);
public System.Text.StringBuilder Insert (int index, decimal value);
member this.Insert : int * decimal -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Decimal) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Decimal

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Decimal.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, Char[])

지정된 유니코드 문자 배열의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, cli::array <char> ^ value);
public System.Text.StringBuilder Insert (int index, char[] value);
public System.Text.StringBuilder Insert (int index, char[]? value);
member this.Insert : int * char[] -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Char()) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Char[]

삽입할 문자 배열입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

또는

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

가 이nullvalueStringBuilder 변경되지 않습니다.

적용 대상

Insert(Int32, Char)

지정된 유니코드 문자의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, char value);
public System.Text.StringBuilder Insert (int index, char value);
member this.Insert : int * char -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Char) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Char

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

또는

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Char.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

추가 정보

적용 대상

Insert(Int32, Byte)

지정된 8비트 부호 없는 정수의 문자열 표현을 지정된 문자 위치에 있는 이 인스턴스에 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, System::Byte value);
public System.Text.StringBuilder Insert (int index, byte value);
member this.Insert : int * byte -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Byte) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Byte

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Byte.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상

Insert(Int32, Boolean)

지정된 문자 위치에 있는 이 인스턴스에 부울 값의 문자열 표현을 삽입합니다.

public:
 System::Text::StringBuilder ^ Insert(int index, bool value);
public System.Text.StringBuilder Insert (int index, bool value);
member this.Insert : int * bool -> System.Text.StringBuilder
Public Function Insert (index As Integer, value As Boolean) As StringBuilder

매개 변수

index
Int32

삽입을 시작할 인스턴스 내의 위치입니다.

value
Boolean

삽입할 값입니다.

반환

삽입 작업이 완료된 후 이 인스턴스에 대한 참조입니다.

예외

index가 0보다 작거나 이 인스턴스 길이보다 큽니다.

이 인스턴스의 값이 커지면 MaxCapacity가 초과됩니다.

설명

Boolean.ToString 는 의 value문자열 표현을 가져오는 데 사용됩니다. 기존 문자는 새 텍스트의 공간을 확보하기 위해 이동됩니다. 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Framework 3.5 서비스 팩 1 이전 버전에서 삽입 value 하면 개체의 총 길이가 를 초과하는 MaxCapacity경우 이 메서드에 대한 호출이 throw ArgumentOutOfRangeException 되었습니다. .NET Framework 4부터 메서드는 을 OutOfMemoryExceptionthrow합니다.

추가 정보

적용 대상