List of usage examples for java.lang StringBuffer StringBuffer
@HotSpotIntrinsicCandidate
public StringBuffer()
From source file:Main.java
public static void main(String[] arg) { StringBuffer buffer = new StringBuffer(); Object o = "from java2s.com"; buffer.append(o);/*ww w . j a v a2s . c o m*/ System.out.println(buffer); }
From source file:Main.java
public static void main(String[] arg) { StringBuffer buffer = new StringBuffer(); long l = 123456789098765L; buffer.append(l);/* w ww.j av a2s . c o m*/ System.out.println(buffer); }
From source file:Main.java
public static void main(String[] argv) { StringBuffer sb = new StringBuffer(); sb.append("java2s.com"); System.out.println(sb.length()); System.out.println(sb.capacity()); sb.trimToSize();/*from w w w . jav a 2 s. c o m*/ System.out.println(sb.length()); System.out.println(sb.capacity()); }
From source file:MainClass.java
public static void main(String[] a) { StringBuffer buf = new StringBuffer(); java.util.Formatter formatter = new java.util.Formatter(buf); double x = 27.5, y = 33.75; formatter.format("x = %15.2f y = %14.3g", x, y); System.out.print(buf);//from w w w.j a va2 s. co m }
From source file:MainClass.java
public static void main(String[] args) { StringBuffer sb = new StringBuffer(); sb.append(true);/* w w w. java2 s . co m*/ sb.append('A'); char[] carray = { 'a', 'b', 'c' }; sb.append(carray); sb.append(carray, 0, 1); sb.append(3.5d); sb.append(2.4f); sb.append(45); sb.append(90000l); sb.append("That's all!"); System.out.println(sb); }
From source file:Main.java
public static void main(String[] args) { StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer, Locale.US); String name = "from java2s.com"; formatter.format("Hello %s !", name); System.out.println(formatter.ioException()); }
From source file:Main.java
public static void main(String[] args) { StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer, Locale.US); // format a new string String name = "from java2s.com"; formatter.format(Locale.US, "Hello %s !", name); // print the formatted string with specified locale System.out.println(formatter + " " + formatter.locale()); }
From source file:Main.java
public static void main(String[] args) { StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer, Locale.US); // format a new string String name = "from java2s.com"; formatter.format("Hello %s !", name); // print the formatted string with default locale System.out.println(formatter + " " + formatter.locale()); }
From source file:Main.java
public static void main(String[] args) { StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer, Locale.US); // format a new string String name = "from java2s.com"; formatter.format("Hello %s !", name); // print the formatted string with default locale System.out.println(formatter); System.out.println(formatter.locale()); }
From source file:Main.java
public static void main(String[] args) { StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer, Locale.US); // format a new string String name = "from java2s.com"; formatter.format("Hello %s !", name); // print the formatted string with default locale System.out.println(formatter); // print the output System.out.println(formatter.out()); }