StringBuffer: insert(int offset, double d) : StringBuffer « java.lang « Java by API






StringBuffer: insert(int offset, double d)

  
public class Main {
  public static void main(String args[]) {
    Object objectRef = "hello";
    String string = "goodbye";
    char charArray[] = { 'a', 'b', 'c', 'd', 'e', 'f' };
    boolean booleanValue = true;
    char characterValue = 'K';
    int integerValue = 7;
    long longValue = 10000000;
    float floatValue = 2.5f;
    double doubleValue = 33.3;

    StringBuffer buffer = new StringBuffer();

    buffer.insert(0, objectRef);
    buffer.insert(0, "  ");
    buffer.insert(0, string);
    buffer.insert(0, "  ");
    buffer.insert(0, charArray);
    buffer.insert(0, "  ");
    buffer.insert(0, charArray, 3, 3);
    buffer.insert(0, "  ");
    buffer.insert(0, booleanValue);
    buffer.insert(0, "  ");
    buffer.insert(0, characterValue);
    buffer.insert(0, "  ");
    buffer.insert(0, integerValue);
    buffer.insert(0, "  ");
    buffer.insert(0, longValue);
    buffer.insert(0, "  ");
    buffer.insert(0, floatValue);
    buffer.insert(0, "  ");
    buffer.insert(0, doubleValue);

    System.out.printf("buffer after inserts:\n%s\n\n", buffer.toString());

  }
}

   
    
  








Related examples in the same category

1.new StringBuffer(int size)
2.new StringBuffer(String str)
3.StringBuffer: append(char c)
4.StringBuffer: append(char[] str, int offset, int len)
5.StringBuffer: append(CharSequence s, int start, int end)
6.StringBuffer: append(double d)
7.StringBuffer: append(float f)
8.StringBuffer: append(int intValue)
9.StringBuffer: append(long lng)
10.StringBuffer: append(String stringValue)
11.StringBuffer: capacity
12.StringBuffer: charAt(int index)
13.StringBuffer: delete(int start, int end)
14.StringBuffer: deleteCharAt(int pos)
15.StringBuffer: getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
16.StringBuffer: insert(int offset, boolean b)
17.StringBuffer: insert(int offset, char c)
18.StringBuffer: insert(int offset, char[] str)
19.StringBuffer: insert(int offset, float f)
20.StringBuffer: insert(int offset, int i)
21.StringBuffer: insert(int offset, long l)
22.StringBuffer: insert(int offset, Object obj)
23.StringBuffer: insert(int offset, String stringValue)
24.StringBuffer: lastIndexOf(String str)
25.StringBuffer: length()
26.StringBuffer: replace(int start, int end, String str)
27.StringBuffer: reverse()
28.StringBuffer: setCharAt(int index)
29.StringBuffer: setLength(int length)
30.StringBuffer: toString()