Append and insert value to StringBuilder

ReturnMethodSummary
StringBuilderappend(boolean b)Appends the string representation of the boolean argument to the sequence.
StringBuilderappend(char c)Appends the string representation of the char argument to this sequence.
StringBuilderappend(char[] str)Appends the string representation of the char array argument to this sequence.
StringBuilderappend(char[] str, int offset, int len)Appends the string representation of a subarray of the char array argument to this sequence.
StringBuilderappend(CharSequence s)Appends the specified character sequence to this Appendable.
StringBuilderappend(CharSequence s, int start, int end)Appends a subsequence of the specified CharSequence to this sequence.
StringBuilderappend(double d)Appends the string representation of the double argument to this sequence.
StringBuilderappend(float f)Appends the string representation of the float argument to this sequence.
StringBuilderappend(int i)Appends the string representation of the int argument to this sequence.
StringBuilderappend(long lng)Appends the string representation of the long argument to this sequence.
StringBuilderappend(Object obj)Appends the string representation of the Object argument.
StringBuilderappend(String str)Appends the specified string to this character sequence.
StringBuilderappend(StringBuffer sb)Appends the specified StringBuffer to this sequence.
StringBuilderappendCodePoint(int codePoint)Appends the string representation of the codePoint argument to this sequence.
StringBuilderinsert(int offset, boolean b)Inserts the string representation of the boolean argument into this sequence.
StringBuilderinsert(int offset, char c)Inserts the string representation of the char argument into this sequence.
StringBuilderinsert(int offset, char[] str)Inserts the string representation of the char array argument into this sequence.
StringBuilderinsert(int index, char[] str, int offset, int len)Inserts the string representation of a subarray of the str array argument into this sequence.
StringBuilderinsert(int dstOffset, CharSequence s)Inserts the specified CharSequence into this sequence.
StringBuilderinsert(int dstOffset, CharSequence s, int start, int end)Inserts a subsequence of the specified CharSequence into this sequence.
StringBuilderinsert(int offset, double d)Inserts the string representation of the double argument into this sequence.
StringBuilderinsert(int offset, float f)Inserts the string representation of the float argument into this sequence.
StringBuilderinsert(int offset, int i)Inserts the string representation of the second int argument into this sequence.
StringBuilderinsert(int offset, long l)Inserts the string representation of the long argument into this sequence.
StringBuilderinsert(int offset, Object obj)Inserts the string representation of the Object argument into this character sequence.
StringBuilderinsert(int offset, String str)Inserts the string into this character sequence.

public class Main {
  public static void main(String[] argv) {
    StringBuilder sb = new StringBuilder();
    sb.append("java2s.com");
    sb.append(123);
    sb.append(1.23);
    sb.append(true);
    System.out.println(sb.toString());

  }
}

The output:


java2s.com1231.23true
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.