List of usage examples for java.lang StringBuffer StringBuffer
public StringBuffer(CharSequence seq)
From source file:Main.java
public static void main(String[] argv) { StringBuffer sb = new StringBuffer(20); System.out.println(sb.capacity()); }
From source file:Main.java
public static void main(String args[]) { StringBuffer sb = new StringBuffer("java2s.com."); sb.deleteCharAt(0);/* ww w . ja v a 2s. co m*/ System.out.println("After deleteCharAt: " + sb); }
From source file:Main.java
public static void main(String args[]) { StringBuffer sb = new StringBuffer("This is a test from java2s.com."); sb.replace(5, 7, "was"); System.out.println("After replace: " + sb); }
From source file:Main.java
public static void main(String args[]) { StringBuffer sb = new StringBuffer("java2s.com"); System.out.println("buffer before = " + sb); sb.setLength(2);//from w w w . j a v a2s . c o m System.out.println("buffer after = " + sb); }
From source file:Main.java
public static void main(String[] arg) { StringBuffer phrase = new StringBuffer("java2s.com"); int position = phrase.lastIndexOf(".com"); System.out.println(position); }
From source file:Main.java
public static void main(String args[]) { StringBuffer buffer = new StringBuffer("hello java2s.com"); System.out.println(buffer.charAt(0)); System.out.println(buffer.charAt(4)); }
From source file:Main.java
public static void main(String[] arg) { StringBuffer buffer = new StringBuffer("from java2s.com"); System.out.println(buffer.lastIndexOf("a", 10)); }
From source file:Main.java
public static void main(String[] arg) { StringBuffer buffer = new StringBuffer("from java2s.com"); System.out.println(buffer.substring(2)); }
From source file:Main.java
public static void main(String[] arg) { StringBuffer buf = new StringBuffer("::"); char[] text = { 'i', 's', ' ', 'e', 'x', 'a', 'c', 't', 'l', 'y' }; buf.append(text, 2, 8);/*from w ww .ja v a 2 s . c o m*/ System.out.println(buf); }
From source file:Main.java
public static void main(String[] arg) { StringBuffer buffer = new StringBuffer("from java2s.com"); System.out.println(buffer.subSequence(1, 2)); }