StringBuilder.Append 메서드

정의

지정된 개체의 문자열 표현을 이 인스턴스에 추가합니다.

오버로드

Append(StringBuilder)

지정된 문자열 빌더의 표현을 이 인스턴스에 추가합니다.

Append(UInt16)

지정된 16비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

Append(UInt32)

지정된 32비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

Append(UInt64)

지정된 64비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

Append(Char, Int32)

유니코드 문자에 대한 문자열 표현의 지정된 복사본 수를 이 인스턴스에 추가합니다.

Append(Char[], Int32, Int32)

유니코드 문자의 지정된 하위 배열에 대한 문자열 표현을 이 인스턴스에 추가합니다.

Append(IFormatProvider, StringBuilder+AppendInterpolatedStringHandler)

지정된 형식을 사용하여 보간된 지정된 문자열을 이 instance 추가합니다.

Append(String)

지정된 문자열의 복사본을 이 인스턴스의 끝에 추가합니다.

Append(String, Int32, Int32)

지정된 부분 문자열의 복사본을 이 인스턴스에 추가합니다.

Append(StringBuilder, Int32, Int32)

지정된 문자열 작성기 내에 있는 부분 문자열의 복사본을 이 인스턴스에 추가합니다.

Append(Char*, Int32)

지정된 주소에서 시작하는 유니코드 문자의 배열을 이 인스턴스에 추가합니다.

Append(Single)

지정된 단정밀도 부동 소수점 숫자의 문자열 표현을 이 인스턴스에 추가합니다.

Append(StringBuilder+AppendInterpolatedStringHandler)

지정된 보간된 문자열을 이 instance 추가합니다.

Append(ReadOnlySpan<Char>)

지정된 읽기 전용 문자 범위를 이 인스턴스에 추가합니다.

Append(SByte)

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

Append(Boolean)

지정된 부울 값의 문자열 표현을 이 인스턴스에 추가합니다.

Append(Byte)

지정된 8비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

Append(Char)

지정된 Char 개체의 문자열 표현을 이 인스턴스에 추가합니다.

Append(Char[])

지정된 배열의 유니코드 문자에 대한 문자열 표현을 이 인스턴스에 추가합니다.

Append(Double)

지정된 배정밀도 부동 소수점 숫자의 문자열 표현을 이 인스턴스에 추가합니다.

Append(Decimal)

지정된 10진수의 문자열 표현을 이 인스턴스에 추가합니다.

Append(Int32)

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

Append(Int64)

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

Append(Object)

지정된 개체의 문자열 표현을 이 인스턴스에 추가합니다.

Append(ReadOnlyMemory<Char>)

지정된 읽기 전용 문자 메모리 영역을 이 인스턴스에 추가합니다.

Append(Int16)

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

Append(StringBuilder)

지정된 문자열 빌더의 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::Text::StringBuilder ^ value);
public System.Text.StringBuilder Append (System.Text.StringBuilder? value);
public System.Text.StringBuilder Append (System.Text.StringBuilder value);
member this.Append : System.Text.StringBuilder -> System.Text.StringBuilder
Public Function Append (value As StringBuilder) As StringBuilder

매개 변수

value
StringBuilder

추가할 문자열 작성기입니다.

반환

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

적용 대상

Append(UInt16)

중요

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

지정된 16비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::UInt16 value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Append (ushort value);
[<System.CLSCompliant(false)>]
member this.Append : uint16 -> System.Text.StringBuilder
Public Function Append (value As UShort) As StringBuilder

매개 변수

value
UInt16

추가할 값입니다.

반환

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

특성

예외

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

설명

메서드는 Append(UInt16) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 이 때문에 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

System.Text.StringBuilder sb = new 
            System.Text.StringBuilder("The range of a 16-bit unsigned integer: ");
sb.Append(UInt16.MinValue).Append(" to ").Append(UInt16.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of a 16-bit unsigned integer: 0 to 65535
let sb = StringBuilder "The range of a 16-bit unsigned integer: "
sb.Append(UInt16.MinValue).Append(" to ").Append UInt16.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of a 16-bit unsigned integer: 0 to 65535
Dim sb As New System.Text.StringBuilder("The range of a 16-bit unsigned integer: ")
sb.Append(UInt16.MinValue).Append(" to ").Append(UInt16.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of a 16-bit unsigned integer: 0 to 65535

메서드는 Append(UInt16) 메서드를 UInt16.ToString(IFormatProvider) 호출하여 의 value문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 작은 문자열을 Append(String) 추가하기 위해 및 AppendFormat(String, Object) 메서드를 호출할 때 특히 발생할 수 있습니다.

추가 정보

적용 대상

Append(UInt32)

중요

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

지정된 32비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::UInt32 value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Append (uint value);
[<System.CLSCompliant(false)>]
member this.Append : uint32 -> System.Text.StringBuilder
Public Function Append (value As UInteger) As StringBuilder

매개 변수

value
UInt32

추가할 값입니다.

반환

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

특성

예외

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

설명

메서드는 Append(UInt32) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 이 때문에 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

System.Text.StringBuilder sb = new 
            System.Text.StringBuilder("The range of a 32-bit unsigned integer: ");
sb.Append(UInt32.MinValue).Append(" to ").Append(UInt32.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of a 32-bit unsigned integer: 0 to 4294967295
let sb = StringBuilder "The range of a 32-bit unsigned integer: "
sb.Append(UInt32.MinValue).Append(" to ").Append UInt32.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of a 32-bit unsigned integer: 0 to 4294967295
Dim sb As New System.Text.StringBuilder("The range of a 32-bit unsigned integer: ")
sb.Append(UInt32.MinValue).Append(" to ").Append(UInt32.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of a 32-bit unsigned integer: 0 to 4294967295

Append(UInt32) 메서드를 UInt32.ToString 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 작은 문자열을 Append(String) 추가하기 위해 및 AppendFormat(String, Object) 메서드를 호출할 때 특히 발생할 수 있습니다.

추가 정보

적용 대상

Append(UInt64)

중요

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

지정된 64비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::UInt64 value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Append (ulong value);
[<System.CLSCompliant(false)>]
member this.Append : uint64 -> System.Text.StringBuilder
Public Function Append (value As ULong) As StringBuilder

매개 변수

value
UInt64

추가할 값입니다.

반환

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

특성

예외

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

설명

메서드는 Append(UInt64) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 이 때문에 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

System.Text.StringBuilder sb = new 
            System.Text.StringBuilder("The range of a 64-bit unsigned integer: ");
sb.Append(UInt64.MinValue).Append(" to ").Append(UInt64.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of a 64-bit unsigned integer: 0 to 18446744073709551615
let sb = StringBuilder "The range of a 64-bit unsigned integer: "
sb.Append(UInt64.MinValue).Append(" to ").Append UInt64.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of a 64-bit unsigned integer: 0 to 18446744073709551615
Dim sb As New System.Text.StringBuilder("The range of a 64-bit unsigned integer: ")
sb.Append(UInt64.MinValue).Append(" to ").Append(UInt64.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of a 64-bit unsigned integer: 0 to 18446744073709551615

메서드는 Append(UInt64) 메서드를 UInt64.ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 작은 문자열을 Append(String) 추가하기 위해 및 AppendFormat(String, Object) 메서드를 호출할 때 특히 발생할 수 있습니다.

추가 정보

적용 대상

Append(Char, Int32)

유니코드 문자에 대한 문자열 표현의 지정된 복사본 수를 이 인스턴스에 추가합니다.

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

매개 변수

value
Char

추가할 문자입니다.

repeatCount
Int32

value를 추가할 횟수입니다.

반환

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

예외

repeatCount가 0보다 작은 경우

또는

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

메모리가 부족합니다.

설명

메서드는 Append(Char, Int32) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

decimal value = 1346.19m;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append('*', 5).AppendFormat("{0:C2}", value).Append('*', 5);
Console.WriteLine(sb);
// The example displays the following output:
//       *****$1,346.19*****
let value = 1346.19m
let sb = StringBuilder()
sb.Append('*', 5).AppendFormat("{0:C2}", value).Append('*', 5) |> ignore
printfn $"{sb}"
// The example displays the following output:
//       *****$1,346.19*****
Dim value As Decimal = 1346.19d
Dim sb As New System.Text.StringBuilder()
sb.Append("*"c, 5).AppendFormat("{0:C2}", value).Append("*"c, 5)
Console.WriteLine(sb)
' The example displays the following output:
'       *****$1,346.19*****

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 작은 문자열을 Append(String) 추가하기 위해 및 AppendFormat(String, Object) 메서드를 호출할 때 특히 발생할 수 있습니다.

추가 정보

적용 대상

Append(Char[], Int32, Int32)

유니코드 문자의 지정된 하위 배열에 대한 문자열 표현을 이 인스턴스에 추가합니다.

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

매개 변수

value
Char[]

문자 배열입니다.

startIndex
Int32

value의 시작 위치입니다.

charCount
Int32

추가할 문자 수입니다.

반환

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

예외

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

charCount가 0보다 작은 경우

또는

startIndex가 0보다 작은 경우

또는

startIndex + charCountvalue의 길이보다 큽니다.

또는

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

설명

이 메서드는 의 지정된 문자 value 범위를 현재 instance 추가합니다. 가 null 및 이 startIndexcount 모두 0이면 value 변경되지 않습니다.

메서드는 Append(Char[], Int32, Int32) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

char[] chars = { 'a', 'b', 'c', 'd', 'e'};
System.Text.StringBuilder sb = new System.Text.StringBuilder();
int startPosition = Array.IndexOf(chars, 'a');
int endPosition = Array.IndexOf(chars, 'c');
if (startPosition >= 0 && endPosition >= 0) {
   sb.Append("The array from positions ").Append(startPosition).
             Append(" to ").Append(endPosition).Append(" contains ").
             Append(chars, startPosition, endPosition + 1).Append(".");
   Console.WriteLine(sb);
}             
// The example displays the following output:
//       The array from positions 0 to 2 contains abc.
let chars = [| 'a'; 'b'; 'c'; 'd'; 'e' |]
let sb = StringBuilder()
let startPosition = Array.IndexOf(chars, 'a')
let endPosition = Array.IndexOf(chars, 'c')

if startPosition >= 0 && endPosition >= 0 then
    sb
        .Append("The array from positions ")
        .Append(startPosition)
        .Append(" to ")
        .Append(endPosition)
        .Append(" contains ")
        .Append(chars, startPosition, endPosition + 1)
        .Append "."
    |> ignore

    printfn $"{sb}"
// The example displays the following output:
//       The array from positions 0 to 2 contains abc.
Dim chars() As Char = { "a"c, "b"c, "c"c, "d"c, "e"c}
Dim sb As New System.Text.StringBuilder()
Dim startPosition As Integer = Array.IndexOf(chars, "a"c)
Dim endPosition As Integer = Array.IndexOf(chars, "c"c)
If startPosition >= 0 AndAlso endPosition >= 0 Then
   sb.Append("The array from positions ").Append(startPosition).
             Append(" to ").Append(endPosition).Append(" contains ").
             Append(chars, startPosition, endPosition + 1).Append(".")
   Console.WriteLine(sb)
End If             
' The example displays the following output:
'       The array from positions 0 to 2 contains abc.

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(IFormatProvider, StringBuilder+AppendInterpolatedStringHandler)

지정된 형식을 사용하여 이 instance 보간된 지정된 문자열을 추가합니다.

public:
 System::Text::StringBuilder ^ Append(IFormatProvider ^ provider, System::Text::StringBuilder::AppendInterpolatedStringHandler % handler);
public System.Text.StringBuilder Append (IFormatProvider? provider, ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler);
member this.Append : IFormatProvider * AppendInterpolatedStringHandler -> System.Text.StringBuilder
Public Function Append (provider As IFormatProvider, ByRef handler As StringBuilder.AppendInterpolatedStringHandler) As StringBuilder

매개 변수

provider
IFormatProvider

문화권별 형식 정보를 제공하는 개체입니다.

handler
StringBuilder.AppendInterpolatedStringHandler

추가할 보간된 문자열입니다.

반환

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

적용 대상

Append(String)

지정된 문자열의 복사본을 이 인스턴스의 끝에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::String ^ value);
public System.Text.StringBuilder Append (string value);
public System.Text.StringBuilder Append (string? value);
member this.Append : string -> System.Text.StringBuilder
Public Function Append (value As String) As StringBuilder

매개 변수

value
String

추가할 문자열입니다.

반환

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

예외

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

설명

메서드는 Append(String) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

bool flag = false;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("The value of the flag is ").Append(flag).Append(".");
Console.WriteLine(sb.ToString());
// The example displays the following output:
//       The value of the flag is False.
let flag = false
let sb = StringBuilder()
sb.Append("The value of the flag is ").Append(flag).Append "." |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The value of the flag is False.
Dim flag As Boolean = false
Dim sb As New System.Text.StringBuilder
sb.Append("The value of the flag is ").Append(flag).Append(".")
Console.WriteLine(sb.ToString())
' The example displays the following output:
'       The value of the flag is False.

이 이nullvalue 변경되지 않습니다.

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(String, Int32, Int32)

지정된 부분 문자열의 복사본을 이 인스턴스에 추가합니다.

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

매개 변수

value
String

추가할 부분 문자열이 포함된 문자열입니다.

startIndex
Int32

value에 있는 부분 문자열의 시작 위치입니다.

count
Int32

value에서 추가할 문자 수입니다.

반환

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

예외

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

count가 0보다 작습니다.

또는

startIndex가 0보다 작습니다.

또는

startIndex + countvalue의 길이보다 큽니다.

또는

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

설명

이 메서드는 의 지정된 문자 value 범위를 현재 instance 추가합니다. 가 null 및 이 startIndexcount 모두 0이면 value 변경되지 않습니다.

메서드는 Append(String, Int32, Int32) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

string str = "First;George Washington;1789;1797";
int index = 0;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
int length = str.IndexOf(';', index);      
sb.Append(str, index, length).Append(" President of the United States: ");
index += length + 1;
length = str.IndexOf(';', index) - index;
sb.Append(str, index, length).Append(", from ");
index += length + 1;
length = str.IndexOf(';', index) - index;
sb.Append(str, index, length).Append(" to ");
index += length + 1;
sb.Append(str, index, str.Length - index);
Console.WriteLine(sb);
// The example displays the following output:
//    First President of the United States: George Washington, from 1789 to 1797
let str = "First;George Washington;1789;1797"
let mutable index = 0
let sb = StringBuilder()
let length = str.IndexOf(';', index)

sb.Append(str, index, length).Append " President of the United States: "
|> ignore

index <- index + length + 1
let length = str.IndexOf(';', index) - index
sb.Append(str, index, length).Append ", from " |> ignore
index <- index + length + 1
let length = str.IndexOf(';', index) - index
sb.Append(str, index, length).Append " to " |> ignore
index <- index + length + 1
sb.Append(str, index, str.Length - index) |> ignore
printfn $"{sb}"
// The example displays the following output:
//    First President of the United States: George Washington, from 1789 to 1797
Dim str As String = "First;George Washington;1789;1797"
Dim index As Integer = 0
Dim sb As New System.Text.StringBuilder()
Dim length As Integer = str.IndexOf(";"c, index)      
sb.Append(str, index, length).Append(" President of the United States: ")
index += length + 1
length = str.IndexOf(";"c, index) - index
sb.Append(str, index, length).Append(", from ")
index += length + 1
length = str.IndexOf(";"c, index) - index
sb.Append(str, index, length).Append(" to ")
index += length + 1
sb.Append(str, index, str.Length - index)
Console.WriteLine(sb)
' The example displays the following output:
'    First President of the United States: George Washington, from 1789 to 1797

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(StringBuilder, Int32, Int32)

지정된 문자열 작성기 내에 있는 부분 문자열의 복사본을 이 인스턴스에 추가합니다.

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

매개 변수

value
StringBuilder

추가할 부분 문자열이 포함된 문자열 작성기입니다.

startIndex
Int32

value에 있는 부분 문자열의 시작 위치입니다.

count
Int32

value에서 추가할 문자 수입니다.

반환

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

적용 대상

Append(Char*, Int32)

중요

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

CLS 대체 규격
System.Text.StringBuilder.Append(Char[], Int32, Int32)

지정된 주소에서 시작하는 유니코드 문자의 배열을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(char* value, int valueCount);
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public System.Text.StringBuilder Append (char* value, int valueCount);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Append (char* value, int valueCount);
[<System.CLSCompliant(false)>]
[<System.Security.SecurityCritical>]
member this.Append : nativeptr<char> * int -> System.Text.StringBuilder
[<System.CLSCompliant(false)>]
member this.Append : nativeptr<char> * int -> System.Text.StringBuilder

매개 변수

value
Char*

문자의 배열에 대한 포인터입니다.

valueCount
Int32

배열에 있는 문자의 수입니다.

반환

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

특성

예외

valueCount가 0보다 작은 경우

또는

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

value이(가) null 포인터입니다.

설명

이 메서드는 주소 value 에서 시작하는 문자를 현재 instance 추가합니다valueCount.

메서드는 Append(Char*, Int32) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

적용 대상

Append(Single)

지정된 단정밀도 부동 소수점 숫자의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(float value);
public System.Text.StringBuilder Append (float value);
member this.Append : single -> System.Text.StringBuilder
Public Function Append (value As Single) As StringBuilder

매개 변수

value
Single

추가할 값입니다.

반환

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

예외

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

설명

메서드는 Append(Single) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

float value = 1034769.47f;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append('*', 5).Append(value).Append('*', 5);
Console.WriteLine(sb);
// The example displays the following output:
//       *****1034769.47*****
let value = 1034769.47f
let sb = StringBuilder()
sb.Append('*', 5).Append(value).Append('*', 5) |> ignore
printfn $"{sb}"
// The example displays the following output:
//       *****1034769.47*****
Dim value As Single = 1034769.47
Dim sb As New System.Text.StringBuilder()
sb.Append("*"c, 5).Append(value).Append("*"c, 5)
Console.WriteLine(sb)
' The example displays the following output:
'       *****1034769.47*****

메서드는 Append(Single) 메서드를 Single.ToString 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(StringBuilder+AppendInterpolatedStringHandler)

지정된 보간된 문자열을 이 instance 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::Text::StringBuilder::AppendInterpolatedStringHandler % handler);
public System.Text.StringBuilder Append (ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler);
member this.Append : AppendInterpolatedStringHandler -> System.Text.StringBuilder
Public Function Append (ByRef handler As StringBuilder.AppendInterpolatedStringHandler) As StringBuilder

매개 변수

handler
StringBuilder.AppendInterpolatedStringHandler

추가할 보간된 문자열입니다.

반환

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

적용 대상

Append(ReadOnlySpan<Char>)

지정된 읽기 전용 문자 범위를 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(ReadOnlySpan<char> value);
public System.Text.StringBuilder Append (ReadOnlySpan<char> value);
member this.Append : ReadOnlySpan<char> -> System.Text.StringBuilder
Public Function Append (value As ReadOnlySpan(Of Char)) As StringBuilder

매개 변수

value
ReadOnlySpan<Char>

추가할 읽기 전용 문자 범위입니다.

반환

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

적용 대상

Append(SByte)

중요

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

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

public:
 System::Text::StringBuilder ^ Append(System::SByte value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Append (sbyte value);
[<System.CLSCompliant(false)>]
member this.Append : sbyte -> System.Text.StringBuilder
Public Function Append (value As SByte) As StringBuilder

매개 변수

value
SByte

추가할 값입니다.

반환

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

특성

예외

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

설명

메서드는 Append(SByte) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

System.Text.StringBuilder sb = new 
            System.Text.StringBuilder("The range of an 8-bit signed integer: ");
sb.Append(SByte.MinValue).Append(" to ").Append(SByte.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of an 8-bit unsigned integer: -128 to 127
let sb = StringBuilder "The range of an 8-bit signed integer: "
sb.Append(SByte.MinValue).Append(" to ").Append SByte.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of an 8-bit unsigned integer: -128 to 127
Dim sb As New System.Text.StringBuilder("The range of an 8-bit signed integer: ")
sb.Append(SByte.MinValue).Append(" to ").Append(SByte.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of an 8-bit unsigned integer: -128 to 127

메서드는 Append(SByte) 메서드를 SByte.ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Boolean)

지정된 부울 값의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(bool value);
public System.Text.StringBuilder Append (bool value);
member this.Append : bool -> System.Text.StringBuilder
Public Function Append (value As Boolean) As StringBuilder

매개 변수

value
Boolean

추가할 Boolean 값입니다.

반환

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

예외

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

설명

메서드는 Append(Boolean) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

bool flag = false;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("The value of the flag is ").Append(flag).Append(".");
Console.WriteLine(sb.ToString());
// The example displays the following output:
//       The value of the flag is False.
let flag = false
let sb = StringBuilder()
sb.Append("The value of the flag is ").Append(flag).Append "." |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The value of the flag is False.
Dim flag As Boolean = false
Dim sb As New System.Text.StringBuilder
sb.Append("The value of the flag is ").Append(flag).Append(".")
Console.WriteLine(sb.ToString())
' The example displays the following output:
'       The value of the flag is False.

메서드는 Append(Boolean) 메서드를 Boolean.ToString() 호출하여 의 value문자열 표현을 가져옵니다. 이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Byte)

지정된 8비트 부호 없는 정수의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::Byte value);
public System.Text.StringBuilder Append (byte value);
member this.Append : byte -> System.Text.StringBuilder
Public Function Append (value As Byte) As StringBuilder

매개 변수

value
Byte

추가할 값입니다.

반환

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

예외

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

설명

메서드는 Append(Byte) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

Byte[] bytes = { 16, 132, 27, 253 };
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (var value in bytes)
   sb.Append(value).Append(" ");         

Console.WriteLine("The byte array: {0}", sb.ToString());
// The example displays the following output:
//         The byte array: 16 132 27 253
let bytes = [| 16uy; 132uy; 27uy; 253uy |]
let sb = StringBuilder()

for value in bytes do
    sb.Append(value).Append " " |> ignore

printfn $"The byte array: {sb}"
// The example displays the following output:
//         The byte array: 16 132 27 253
Dim bytes() As Byte = { 16, 132, 27, 253 }
Dim sb As New System.Text.StringBuilder()
For Each value In bytes
   sb.Append(value).Append(" ")         
Next
Console.WriteLine("The byte array: {0}", sb.ToString())
' The example displays the following output:
'         The byte array: 16 132 27 253

메서드는 Append(Byte) 메서드를 ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Char)

지정된 Char 개체의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(char value);
public System.Text.StringBuilder Append (char value);
member this.Append : char -> System.Text.StringBuilder
Public Function Append (value As Char) As StringBuilder

매개 변수

value
Char

추가할 UTF-16 인코딩된 코드 단위입니다.

반환

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

예외

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

설명

메서드는 Append(Char) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

string str = "Characters in a string.";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (var ch in str)
   sb.Append(" '").Append(ch).Append("' ");

Console.WriteLine("Characters in the string:");
Console.WriteLine("  {0}", sb);
// The example displays the following output:
//    Characters in the string:
//       'C'  'h'  'a'  'r'  'a'  'c'  't'  'e'  'r'  's'  ' '  'i'  'n'  ' '  'a'  ' '  's'  't' 'r'  'i'  'n'  'g'  '.'
let str = "Characters in a string."
let sb = StringBuilder()

for ch in str do
    sb.Append(" '").Append(ch).Append "' " |> ignore

printfn "Characters in the string:"
printfn $"  {sb}"
// The example displays the following output:
//    Characters in the string:
//       'C'  'h'  'a'  'r'  'a'  'c'  't'  'e'  'r'  's'  ' '  'i'  'n'  ' '  'a'  ' '  's'  't' 'r'  'i'  'n'  'g'  '.'
Dim str As String = "Characters in a string."
Dim sb As New System.Text.StringBuilder()
For Each ch In str
   sb.Append(" '").Append(ch).Append("' ")
Next
Console.WriteLine("Characters in the string:")
Console.WriteLine("  {0}", sb)
' The example displays the following output:
'    Characters in the string:
'       'C'  'h'  'a'  'r'  'a'  'c'  't'  'e'  'r'  's'  ' '  'i'  'n'  ' '  'a'  ' '  's'  't' 'r'  'i'  'n'  'g'  '.'

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Char[])

지정된 배열의 유니코드 문자에 대한 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(cli::array <char> ^ value);
public System.Text.StringBuilder Append (char[] value);
public System.Text.StringBuilder Append (char[]? value);
member this.Append : char[] -> System.Text.StringBuilder
Public Function Append (value As Char()) As StringBuilder

매개 변수

value
Char[]

추가할 문자 배열입니다.

반환

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

예외

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

설명

이 메서드는 지정된 배열의 모든 문자를 현재 instance 에 표시되는 value순서와 동일한 순서로 추가합니다. 이 이nullvalue 변경되지 않습니다.

메서드는 Append(Char[]) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

char[] chars = { 'a', 'e', 'i', 'o', 'u' };
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("The characters in the array: ").Append(chars);
Console.WriteLine(sb);
// The example displays the following output:
//      The characters in the array: aeiou
let chars = [| 'a'; 'e'; 'i'; 'o'; 'u' |]
let sb = StringBuilder()
sb.Append("The characters in the array: ").Append chars |> ignore
printfn $"{sb}"
// The example displays the following output:
//      The characters in the array: aeiou
Dim chars() As Char = { "a"c, "e"c, "i"c, "o"c, "u"c }
Dim sb As New System.Text.StringBuilder()
sb.Append("The characters in the array: ").Append(chars)
Console.WriteLine(sb)
' The example displays the following output:
'      The characters in the array: aeiou

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

적용 대상

Append(Double)

지정된 배정밀도 부동 소수점 숫자의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(double value);
public System.Text.StringBuilder Append (double value);
member this.Append : double -> System.Text.StringBuilder
Public Function Append (value As Double) As StringBuilder

매개 변수

value
Double

추가할 값입니다.

반환

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

예외

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

설명

메서드는 Append(Double) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

double value = 1034769.47;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append('*', 5).Append(value).Append('*', 5);
Console.WriteLine(sb);
// The example displays the following output:
//       *****1034769.47*****
let value = 1034769.47
let sb = StringBuilder()
sb.Append('*', 5).Append(value).Append('*', 5) |> ignore
printfn $"{sb}"
// The example displays the following output:
//       *****1034769.47*****
Dim value As Double = 1034769.47
Dim sb As New System.Text.StringBuilder()
sb.Append("*"c, 5).Append(value).Append("*"c, 5)
Console.WriteLine(sb)
' The example displays the following output:
'       *****1034769.47*****

메서드는 Append(Double) 메서드를 Double.ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Decimal)

지정된 10진수의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::Decimal value);
public System.Text.StringBuilder Append (decimal value);
member this.Append : decimal -> System.Text.StringBuilder
Public Function Append (value As Decimal) As StringBuilder

매개 변수

value
Decimal

추가할 값입니다.

반환

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

예외

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

설명

메서드는 Append(Decimal) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

decimal value = 1346.19m;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append('*', 5).Append(value).Append('*', 5);
Console.WriteLine(sb);
// The example displays the following output:
//       *****1346.19*****
let value = 1346.19m
let sb = StringBuilder()
sb.Append('*', 5).Append(value).Append('*', 5) |> ignore
printfn $"{sb}"
// The example displays the following output:
//       *****1346.19*****
Dim value As Decimal = 1346.19d
Dim sb As New System.Text.StringBuilder()
sb.Append("*"c, 5).Append(value).Append("*"c, 5)
Console.WriteLine(sb)
' The example displays the following output:
'       *****1346.19*****

메서드는 Append(Decimal) 메서드를 Decimal.ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Int32)

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

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

매개 변수

value
Int32

추가할 값입니다.

반환

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

예외

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

설명

메서드는 Append(Int32) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

System.Text.StringBuilder sb = new 
       System.Text.StringBuilder("The range of a 32-bit integer: ");
sb.Append(Int32.MinValue).Append(" to ").Append(Int32.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of a 32-bit integer: -2147483648 to 2147483647
let sb = StringBuilder "The range of a 32-bit integer: "
sb.Append(Int32.MinValue).Append(" to ").Append Int32.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of a 32-bit integer: -2147483648 to 2147483647
Dim sb As New System.Text.StringBuilder("The range of a 32-bit integer: ")
sb.Append(Int32.MinValue).Append(" to ").Append(Int32.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of a 32-bit integer: -2147483648 to 2147483647

메서드는 Append(Int32) 메서드를 Int32.ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Int64)

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

public:
 System::Text::StringBuilder ^ Append(long value);
public System.Text.StringBuilder Append (long value);
member this.Append : int64 -> System.Text.StringBuilder
Public Function Append (value As Long) As StringBuilder

매개 변수

value
Int64

추가할 값입니다.

반환

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

예외

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

설명

메서드는 Append(Int64) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

System.Text.StringBuilder sb = new 
            System.Text.StringBuilder("The range of a 64-bit integer: ");
sb.Append(Int64.MinValue).Append(" to ").Append(Int64.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of a 64-bit integer:  -9223372036854775808 to 9223372036854775807
let sb = StringBuilder "The range of a 64-bit integer: "
sb.Append(Int64.MinValue).Append(" to ").Append Int64.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of a 64-bit integer:  -9223372036854775808 to 9223372036854775807
Dim sb As New System.Text.StringBuilder("The range of a 64-bit integer: ")
sb.Append(Int64.MinValue).Append(" to ").Append(Int64.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of a 64-bit integer:  -9223372036854775808 to 9223372036854775807

메서드는 Append(Int64)Int64.ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(Object)

지정된 개체의 문자열 표현을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(System::Object ^ value);
public System.Text.StringBuilder Append (object value);
public System.Text.StringBuilder Append (object? value);
member this.Append : obj -> System.Text.StringBuilder
Public Function Append (value As Object) As StringBuilder

매개 변수

value
Object

추가할 개체입니다.

반환

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

예외

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

설명

메서드는 Append(Object) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다. 클래스를 Dog 정의하고, 개체를 Dog 만들고, 메서드를 Append 세 번 호출하여 강아지의 이름과 품종을 포함하는 문자열을 만듭니다.

using System;

public class Dog
{
   private string dogBreed;
   private string dogName;
   
   public Dog(string name, string breed)
   {
      this.dogName = name;
      this.dogBreed = breed;
   }
   
   public string Breed {
      get { return this.dogBreed; }
   }
   
   public string Name {
      get { return this.dogName; }
   }
   
   public override string ToString()
   {
      return this.dogName;
   }
}

public class Example
{
   public static void Main()
   {
      Dog dog1 = new Dog("Yiska", "Alaskan Malamute");
      System.Text.StringBuilder sb = new System.Text.StringBuilder();     
      sb.Append(dog1).Append(", Breed: ").Append(dog1.Breed);  
      Console.WriteLine(sb);
   }
}
// The example displays the following output:
//        Yiska, Breed: Alaskan Malamute
open System.Text

type Dog(name: string, breed: string) =
    member _.Name = name
    member _.Breed = breed
    override _.ToString() = name

let dog1 = Dog("Yiska", "Alaskan Malamute")
let sb = StringBuilder()
sb.Append(dog1).Append(", Breed: ").Append dog1.Breed |> printfn "%O"

// The example displays the following output:
//        Yiska, Breed: Alaskan Malamute
Public Class Dog
   Private dogBreed As String
   Private dogName As String
   
   Public Sub New(name As String, breed As String)
      Me.dogName = name
      Me.dogBreed = breed
   End Sub
   
   Public ReadOnly Property Breed As String
      Get
         Return Me.dogBreed
      End Get
   End Property
   
   Public ReadOnly Property Name As String
      Get
         Return Me.dogName
      End Get
   End Property
   
   Public Overrides Function ToString() As String
      Return Me.dogName
   End Function
End Class
   
Module Example
   Public Sub Main()
      Dim dog1 As New Dog("Yiska", "Alaskan Malamute")
      Dim sb As New System.Text.StringBuilder()     
      sb.Append(dog1).Append(", Breed: ").Append(dog1.Breed)  
      Console.WriteLine(sb)
   End Sub
End Module
' The example displays the following output:
'       Yiska, Breed: Alaskan Malamute

메서드는 Append(Object) 메서드를 Object.ToString 호출하여 의 value문자열 표현을 가져옵니다. 이 이nullvalue 개체가 StringBuilder 변경되지 않습니다.

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상

Append(ReadOnlyMemory<Char>)

지정된 읽기 전용 문자 메모리 영역을 이 인스턴스에 추가합니다.

public:
 System::Text::StringBuilder ^ Append(ReadOnlyMemory<char> value);
public System.Text.StringBuilder Append (ReadOnlyMemory<char> value);
member this.Append : ReadOnlyMemory<char> -> System.Text.StringBuilder
Public Function Append (value As ReadOnlyMemory(Of Char)) As StringBuilder

매개 변수

value
ReadOnlyMemory<Char>

추가할 읽기 전용 문자 메모리 영역입니다.

반환

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

적용 대상

Append(Int16)

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

public:
 System::Text::StringBuilder ^ Append(short value);
public System.Text.StringBuilder Append (short value);
member this.Append : int16 -> System.Text.StringBuilder
Public Function Append (value As Short) As StringBuilder

매개 변수

value
Int16

추가할 값입니다.

반환

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

예외

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

설명

메서드는 Append(Int16) 이 클래스의 기존 instance 수정합니다. 새 클래스 instance 반환하지 않습니다. 따라서 기존 참조에서 메서드 또는 속성을 호출할 수 있으며 다음 예제와 같이 개체에 반환 값을 할당할 StringBuilder 필요가 없습니다.

System.Text.StringBuilder sb = new 
       System.Text.StringBuilder("The range of a 16-bit integer: ");
sb.Append(Int16.MinValue).Append(" to ").Append(Int16.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of a 16-bit integer: -32768 to 32767
let sb = StringBuilder "The range of a 16-bit integer: "
sb.Append(Int16.MinValue).Append(" to ").Append Int16.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of a 16-bit integer: -32768 to 32767
Dim sb As New System.Text.StringBuilder("The range of a 16-bit integer: ")
sb.Append(Int16.MinValue).Append(" to ").Append(Int16.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of a 16-bit integer: -32768 to 32767

메서드는 Append(Int16) 메서드를 Int16.ToString(IFormatProvider) 호출하여 현재 문화권에 대한 의 value 문자열 표현을 가져옵니다. 의 value서식을 제어하려면 메서드를 호출합니다 AppendFormat .

이 instance 용량은 필요에 따라 조정됩니다.

호출자 참고

.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder(Int32, Int32) 하여 개체를 인스턴스화 StringBuilder 할 때 instance 길이와 용량 StringBuilder 이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 특히 및 AppendFormat(String, Object) 메서드를 Append(String) 호출하여 작은 문자열을 추가할 때 발생할 수 있습니다.

추가 정보

적용 대상