List of usage examples for java.lang StringBuffer toString
@Override @HotSpotIntrinsicCandidate public synchronized String toString()
From source file:Main.java
public static String extractText(Node n) { StringBuffer buf = new StringBuffer(); extractText(n, buf);//from w w w. ja v a 2 s .c o m return buf.toString().trim(); }
From source file:Main.java
public static String colorFont(String src, String color) { StringBuffer strBuf = new StringBuffer(); strBuf.append("<font color=").append(color).append(">").append(src).append("</font>"); return strBuf.toString(); }
From source file:Main.java
/** @param doc an XML document. * @return a string representing the stringified version of that document, with minor pretty-printing. */// w w w. j ava2s . c o m public static String doc2String(Document doc) { //System.out.println("XMLUtils: converting doc to string"); StringBuffer result = new StringBuffer(); doc2String(doc.getFirstChild(), result, 0); return result.toString(); }
From source file:Main.java
public static String formatFaces(String emojiName) { //System.out.println("emojiName=="+emojiName); StringBuffer sb = new StringBuffer(); sb.append("<img src=\"emoji_"); sb.append(emojiName);/*from w w w . ja v a 2 s.com*/ sb.append("\">"); return sb.toString(); }
From source file:Main.java
public static String printElements(Document dom) { if (dom == null) return null; StringBuffer sb = new StringBuffer(); walkNodes(dom, sb, ""); return sb.toString(); }
From source file:Main.java
/** * Returns a String containing the concatenation of text contained in the * given node list. This includes Text nodes in the list, and Text node * children of Element nodes and their Element node children. * // w w w .j av a 2 s .c o m * @param nodeList a NodeList object * @return a concatenation of the descendent text */ public static String getChildrenText(NodeList nodeList) { StringBuffer buf = new StringBuffer(); getChildrenText(nodeList, buf); return buf.toString(); }
From source file:Main.java
public static String limitLenOfStr(String str, int maxLen) { if (null != str && str.length() > maxLen) { StringBuffer sb = new StringBuffer(); sb.append(str.substring(0, maxLen)); sb.append("..."); return sb.toString(); }/*from w w w .j a v a 2 s .c o m*/ return str; }
From source file:Main.java
/** * Returns <code>count</code> copies of the given character. * // w w w .j a v a2 s . c om * @param count * @param ch * @return */ public static String getNChars(int count, char ch) { StringBuffer buf = new StringBuffer(count); for (int i = 0; i < count; i++) buf.append(ch); return buf.toString(); }
From source file:Main.java
public static String toHex(byte[] buf) { if (buf == null) return ""; StringBuffer result = new StringBuffer(2 * buf.length); for (byte b : buf) { appendHex(result, b);//from www .ja v a 2 s . c o m } return result.toString(); }
From source file:Main.java
public static final String arrayToString(byte[] bytes) { StringBuffer buff = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { buff.append(bytes[i] + " "); }//from w w w . j av a 2s. c om return buff.toString(); }