List of usage examples for java.lang StringBuilder StringBuilder
public StringBuilder(CharSequence seq)
From source file:Main.java
public static void main(String[] argv) { StringBuilder sb = new StringBuilder(20); System.out.println(sb.capacity()); }
From source file:Main.java
public static void main(String args[]) { StringBuilder sb = new StringBuilder("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[]) { StringBuilder sb = new StringBuilder("java2s.com."); sb.deleteCharAt(0);//from w w w . j a va 2 s.c om System.out.println("After deleteCharAt: " + sb); }
From source file:Main.java
public static void main(String[] args) { StringBuilder sb = new StringBuilder(200); // Capacity:200, length:0 sb.append("Hello"); // Capacity:200, length:5 int len = sb.length(); // len is assigned 5 int capacity = sb.capacity(); // capacity is assigned 200 }
From source file:Main.java
public static void main(String args[]) { StringBuilder sb = new StringBuilder("java2s.com"); System.out.println("buffer before = " + sb); sb.setLength(2);/*from w w w. ja v a 2 s .c o m*/ System.out.println("buffer after = " + sb); }
From source file:Main.java
public static void main(String args[]) { StringBuilder buffer = new StringBuilder("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) { StringBuilder phrase = new StringBuilder("java2s.com"); int position = phrase.lastIndexOf(".com"); System.out.println(position); }
From source file:Main.java
public static void main(String[] arg) { StringBuilder buffer = new StringBuilder("from java2s.com"); System.out.println(buffer.codePointAt(2)); }
From source file:Main.java
public static void main(String[] arg) { StringBuilder buffer = new StringBuilder("from java2s.com"); System.out.println(buffer.offsetByCodePoints(1, 2)); }
From source file:Main.java
public static void main(String[] arg) { StringBuilder buffer = new StringBuilder("from java2s.com"); System.out.println(buffer.indexOf("ava", 2)); }