StringBuilder append: int, char, string, boolean at specific position : StringBuffer StringBuilder « Language Basics « C# / C Sharp






StringBuilder append: int, char, string, boolean at specific position

StringBuilder append: int, char, string, boolean at specific position

using System;
using System.Text;
   
class Test {
  public static void Main() {
    StringBuilder myStringBuilder = new StringBuilder();
    string myString = "www.java2s.com";
    myStringBuilder.Append(myString);
    myStringBuilder.Append(", www.java2s.com... ");
    int myInt = 1234;
    myStringBuilder.Append(myInt);
    bool myBool = true;
    myStringBuilder.Append(myBool);
   
    myStringBuilder.Append('z', 5);
   
    myStringBuilder.Append("Here's another string", 0, 4);
   
    Console.WriteLine("myStringBuilder = " + myStringBuilder);
  }
   
}
           
       








Related examples in the same category

1.StringBuilder EnsureCapacity methodStringBuilder EnsureCapacity method
2.Demonstrating StringBuilder AppendFormatDemonstrating StringBuilder AppendFormat
3.StringBuilder's properties for different constructorsStringBuilder's properties for different constructors
4.StringBuilder AppendFormat() method to add a formatted string containing a floating point number to myStringBuilderStringBuilder AppendFormat() method to add a formatted string containing a floating point number to myStringBuilder
5.StringBuilder Insert(): insert strings into myStringBuilderStringBuilder Insert(): insert strings into myStringBuilder
6.Use the Remove() method to remove part of StringBuilderUse the Remove() method to remove part of StringBuilder
7.Replace(): replace part of myStringBuilderReplace(): replace part of myStringBuilder
8.ToString(): convert myStringBuilder to a stringToString(): convert myStringBuilder to a string
9.illustrates the use of StringBuilder objectsillustrates the use of StringBuilder objects
10.StringBuffer: Replacing CharactersStringBuffer: Replacing Characters
11.StringBuilder foreach StringBuilder foreach
12.StringBuilder: write lineStringBuilder: write line