List of usage examples for java.lang StringBuffer toString
@Override @HotSpotIntrinsicCandidate public synchronized String toString()
From source file:Main.java
public static String repeat(String str, int times) { StringBuffer sbf = new StringBuffer(); for (int i = 0; i < times; i++) { sbf.append(str);// w w w.ja v a2 s.c o m } return sbf.toString(); }
From source file:Main.java
private static String getString(byte[] b) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { sb.append(b[i]);//from w ww . ja v a 2s. co m } return sb.toString(); }
From source file:Main.java
/** * Used to print out a string for error messages, * chops is off at 60 chars for historical reasons. *///from ww w .j a va 2 s.c o m public final static String formatForPrint(String input) { if (input.length() > 60) { StringBuffer tmp = new StringBuffer(input.substring(0, 60)); tmp.append("&"); input = tmp.toString(); } return input; }
From source file:Main.java
public static String maskCardNumber(String clearcardnumber) throws Exception { if (clearcardnumber.length() < 10) { throw new Exception("Invalid number of digits"); }//from w w w . j ava 2 s . c o m int length = clearcardnumber.length(); String prefix = clearcardnumber.substring(0, 4); String suffix = clearcardnumber.substring(length - 4); StringBuffer mask = new StringBuffer(); mask.append(prefix).append("XXXXXXXXXX").append(suffix); return mask.toString(); }
From source file:Main.java
public static String listToString(List list) { StringBuffer sb = new StringBuffer(); for (Object o : list) { sb.append(o.toString() + " "); }/* w w w . j a va 2 s . co m*/ return sb.toString(); }
From source file:Main.java
public static String wrapStringByXmlType(String str) { StringBuffer sb = new StringBuffer(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.append(str);/* w w w. jav a 2 s . c o m*/ return sb.toString(); }
From source file:Main.java
public static String nodeToString(Node node) throws TransformerException { StringBuffer buf = new StringBuffer(); nodeToString(node, buf);// ww w . j a va2s . co m return buf.toString(); }
From source file:Main.java
public static String getBeforeExtension(String path, String insert) { if (getFileExtension(path).equals("") || getFileExtension(path) == null) { return null; }/* w w w . ja v a2s. c om*/ StringBuffer sb = new StringBuffer(path); int index = path.lastIndexOf("."); sb.insert(index, insert); return sb.toString(); }
From source file:Main.java
/** * Gets the column letter corresponding to the 0-based column number * /*from w w w.j a v a 2 s . com*/ * @param column the column number * @return the letter for that column number */ public static String getColumnReference(int column) { StringBuffer buf = new StringBuffer(); getColumnReference(column, buf); return buf.toString(); }
From source file:Main.java
public static String getStringByStringBuffer(String... strings) { StringBuffer builder = new StringBuffer(); for (String string : strings) { builder.append(string);/* ww w. ja v a 2s. c o m*/ } return builder.toString(); }