List of usage examples for java.lang StringBuffer toString
@Override @HotSpotIntrinsicCandidate public synchronized String toString()
From source file:Main.java
public static String filterHtml(String str) { Pattern pattern = Pattern.compile(regxpForHtml); Matcher matcher = pattern.matcher(str); StringBuffer sb = new StringBuffer(); boolean result1 = matcher.find(); while (result1) { matcher.appendReplacement(sb, ""); result1 = matcher.find();//from w w w . j a v a2 s . com } matcher.appendTail(sb); return sb.toString(); }
From source file:Main.java
public static String getASCII(String value) { StringBuffer sbu = new StringBuffer(); char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { if (i != chars.length - 1) { sbu.append((int) chars[i]); }//w ww . ja v a 2 s. c o m } return sbu.toString(); }
From source file:com.salesmanager.core.util.ReferenceUtil.java
public static String buildCentralUri(MerchantStore store) { StringBuffer chk = new StringBuffer(); chk.append(getSecureDomain(store)).append((String) conf.getString("core.salesmanager.central.url")); return chk.toString(); }
From source file:gov.nih.nci.lv.util.LVUtils.java
/** * converts a string array to string concat with a , to be used in a sql. * @param ids ids/* ww w.j a va 2 s .c o m*/ * @param delimiter delimiter * @return String */ public static String convertListToNumberConcat(List<Long> ids, String delimiter) { StringBuffer data = new StringBuffer(); for (Long id : ids) { data.append(id + delimiter); } return StringUtils.removeEnd(data.toString(), delimiter); }
From source file:Main.java
public static String getCustomerXml(String name, String uname) { StringBuffer buffer = new StringBuffer(); buffer.append("<customer>"); buffer.append("<name>" + name + "</name>"); buffer.append("<uname>" + uname + "</uname>"); buffer.append("</customer>"); return buffer.toString(); }
From source file:Main.java
/** * Concatenates an array of string using a seperator. * * @param strings the strings to concatenate * @param separator the seperator between two strings * @return the concatened strings//www . j av a2s. com */ public static String toString(String[] strings, String separator) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < strings.length; i++) { if (i > 0) { sb.append(separator); } sb.append(strings[i]); } return sb.toString(); }
From source file:Main.java
public static String listToString(List<String> weeks) { if (weeks == null || weeks.isEmpty()) { return ""; }/* w w w. j a va2s . c o m*/ StringBuffer result = new StringBuffer(); for (String week : weeks) { result.append(week).append(","); } if (result.length() != 0) { result.deleteCharAt(result.length() - 1); } return result.toString(); }
From source file:Main.java
public static String readerToString(BufferedReader reader) { StringBuffer rawBody = new StringBuffer(); String line = null;//w w w.ja va2 s .com try { while ((line = reader.readLine()) != null) rawBody.append(line); } catch (Exception e) { /*report an error*/ } return rawBody.toString(); }
From source file:Main.java
private static String getDigitsOnly(String s) { StringBuffer digitsOnly = new StringBuffer(); char c;//from w ww. j a v a2s. co m for (int i = 0; i < s.length(); i++) { c = s.charAt(i); if (Character.isDigit(c)) { digitsOnly.append(c); } } return digitsOnly.toString(); }
From source file:Main.java
/** * This method takes Node object as argument and return the value of the * first child of the node.//www . ja v a2 s .c om * <p/> * If there is no such node, this will return null. * * @param node * Node object * @return <code>String</code> returns the value of the node */ public static String getTagValue(Node node) { NodeList childNodeList = node.getChildNodes(); String value; if (childNodeList == null) { value = ""; } else { StringBuffer buffer = new StringBuffer(); for (int j = 0; j < childNodeList.getLength(); j++) { buffer.append(childNodeList.item(j).getNodeValue()); } value = buffer.toString(); } return value; }