List of usage examples for java.lang StringBuilder deleteCharAt
@Override public StringBuilder deleteCharAt(int index)
From source file:com.jfinal.ext.kit.ModelFingerprint.java
public String calcFingerprint() { if (fingerprint == null) { StringBuilder sb = new StringBuilder(); for (String col : fingerprintColumns()) { sb.append(get(col));/* w w w.j av a2s . c o m*/ sb.append("|"); } sb.deleteCharAt(sb.length() - 1); try { MessageDigest md = MessageDigest.getInstance("MD5"); fingerprint = Hex.encodeHexString(md.digest(sb.toString().getBytes())); } catch (Exception e) { fingerprint = "" + hashCode(); } } return fingerprint; }
From source file:edu.cornell.mannlib.vitro.webapp.utils.developer.loggers.StackTraceUtility.java
private String assembleCallStackString() { StringBuilder stack = new StringBuilder(); for (StackTraceElement ste : stackTrace) { stack.append(ste.getClassName()).append(" ").append(ste.getMethodName()).append(" "); }/* w ww. ja v a 2 s . co m*/ return stack.deleteCharAt(stack.length() - 1).toString(); }
From source file:com.gargoylesoftware.htmlunit.CodeStyleTest.java
private static List<String> alertsToList(final List<String> lines, final int alertsIndex, final boolean preserveCommas) { if (" @Alerts".equals(lines.get(alertsIndex))) { lines.set(alertsIndex, " @Alerts()"); }/*from w w w .j a v a2 s . c o m*/ if (!lines.get(alertsIndex).startsWith(" @Alerts(")) { throw new IllegalArgumentException("No @Alerts found in " + (alertsIndex + 1)); } final StringBuilder alerts = new StringBuilder(); for (int i = alertsIndex;; i++) { final String line = lines.get(i); if (alerts.length() != 0) { alerts.append('\n'); } if (line.startsWith(" @Alerts(")) { alerts.append(line.substring(" @Alerts(".length())); } else { alerts.append(line); } if (line.endsWith(")")) { alerts.deleteCharAt(alerts.length() - 1); break; } } final List<String> list = alertsToList(alerts.toString()); if (!preserveCommas) { for (int i = 0; i < list.size(); i++) { String value = list.get(i); if (value.startsWith(",")) { value = value.substring(1).trim(); } list.set(i, value); } } return list; }
From source file:com.hp.autonomy.aci.content.ranges.Range.java
@Override public String toString() { if (ArrayUtils.isNotEmpty(ranges)) { final StringBuilder stringBuilder = new StringBuilder("FIXED{"); if (noMin) { stringBuilder.append(".,"); }//from w w w. j a v a 2s . co m for (final double range : ranges) { stringBuilder.append(range).append(','); } stringBuilder.deleteCharAt(stringBuilder.length() - 1); if (noMax) { stringBuilder.append(",."); } stringBuilder.append("}:") .append(FIELD_SEPARATOR.matcher(field).replaceAll(Matcher.quoteReplacement("%3A"))); return stringBuilder.toString(); } else { return ""; } }
From source file:com.predic8.membrane.core.interceptor.schemavalidation.ValidatorInterceptor.java
@Override public String getLongDescription() { StringBuilder sb = new StringBuilder(getShortDescription()); sb.deleteCharAt(sb.length() - 1);/* w ww .ja v a 2s .com*/ sb.append(" according to "); if (wsdl != null) { sb.append("the WSDL at <br/>"); sb.append(TextUtil.linkURL(wsdl)); } if (schema != null) { sb.append("the XML Schema at <br/>"); sb.append(TextUtil.linkURL(schema)); } if (jsonSchema != null) { sb.append("the JSON Schema at <br/>"); sb.append(TextUtil.linkURL(jsonSchema)); } if (schematron != null) { sb.append("the Schematron at <br/>"); sb.append(TextUtil.linkURL(schematron)); } sb.append(" ."); return sb.toString(); }
From source file:com.core.util.wx.PayUtils.java
/** * ?????/* ww w .j ava 2 s . c o m*/ */ public static String formatBizQueryParaMap(Map<String, String> paraMap, boolean urlencode) { StringBuilder sb = new StringBuilder(); TreeMap<String, String> sortMap = new TreeMap<String, String>(paraMap); if (urlencode) { try { for (String key : sortMap.keySet()) { sb.append(key).append("=").append(URLEncoder.encode(sortMap.get(key), "UTF-8")).append("&"); } } catch (UnsupportedEncodingException e) { LOG.error(e.getMessage(), e); } } else { for (String key : sortMap.keySet()) { sb.append(key).append("=").append(sortMap.get(key)).append("&"); } } if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
From source file:net.sourceforge.fenixedu.domain.candidacyProcess.erasmus.TypeOfProgrammeList.java
private String convertToString(Set<TypeOfProgramme> types) { final StringBuilder result = new StringBuilder(); for (TypeOfProgramme each : types) { result.append(each.name()).append(","); }//from w w w . j a va2 s . co m if (result.length() > 0 && result.charAt(result.length() - 1) == ',') { result.deleteCharAt(result.length() - 1); } return result.toString(); }
From source file:net.sourceforge.fenixedu.domain.phd.PhdElementsList.java
private String convertToString(Set<T> types) { final StringBuilder result = new StringBuilder(); for (T each : types) { result.append(convertElementToString(each)).append(","); }//from ww w. j a va2 s . co m if (result.length() > 0 && result.charAt(result.length() - 1) == ',') { result.deleteCharAt(result.length() - 1); } return result.toString(); }
From source file:com.stratio.ingestion.serializer.elasticsearch.ElasticSearchSerializerWithMappingTest.java
private String trimAllWhitespace(String str) { if (!hasLength(str)) { return str; }// w w w .j av a2 s . c o m StringBuilder sb = new StringBuilder(str); int index = 0; while (sb.length() > index) { if (Character.isWhitespace(sb.charAt(index))) { sb.deleteCharAt(index); } else { index++; } } return sb.toString(); }
From source file:net.sourceforge.fenixedu.domain.candidacyProcess.erasmus.StorkAttributesList.java
private String convertToString(Set<StorkAttributeType> types) { final StringBuilder result = new StringBuilder(); for (StorkAttributeType each : types) { result.append(each.name()).append(","); }/* w ww . j av a 2s . c o m*/ if (result.length() > 0 && result.charAt(result.length() - 1) == ',') { result.deleteCharAt(result.length() - 1); } return result.toString(); }