C# StringBuilder Append(Char, Int32)

Description

StringBuilder Append(Char, Int32) Appends a specified number of copies of the string representation of a Unicode character to this instance.

Syntax

StringBuilder.Append(Char, Int32) has the following syntax.


public StringBuilder Append(
  char value,
  int repeatCount
)

Parameters

StringBuilder.Append(Char, Int32) has the following parameters.

  • value - The character to append.
  • repeatCount - The number of times to append value.

Returns

StringBuilder.Append(Char, Int32) method returns A reference to this instance after the append operation has completed.

Example


using System;/*from   w  w  w.ja  v a2  s. c  o m*/
using System.Text;
using System.Globalization;

class Sample 
{
    public static void Main() 
    {
        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 code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding