List of usage examples for java.lang StringBuilder append
@Override public StringBuilder append(double d)
From source file:test.SomeMainClass.java
private static String dumpConfiguration(Configuration configuration) { StringBuilder sb = new StringBuilder("Config@" + configuration.hashCode()); sb.append("\n"); sb.append(configuration.toString()); sb.append("\n"); Properties props = new Properties(); if (configuration != null) { for (Map.Entry<String, String> entry : configuration) { props.setProperty(entry.getKey(), entry.getValue()); }//from ww w . j a va 2 s. c o m } return sb.append(props.toString()).toString(); }
From source file:com.marklogic.contentpump.utilities.XMLUtil.java
public static String convertToCDATA(String arg) { StringBuilder sb = new StringBuilder(); sb.append("<![CDATA["); sb.append(arg);//ww w . j a va 2 s .co m sb.append("]]>"); return sb.toString(); }
From source file:de.webtech2.croaking.services.impl.Invoker.java
public static String invoke(Class<?> clazz, Object... arguments) { StringBuilder builder = new StringBuilder(); builder.append(clazz.getSimpleName()).append("("); if (arguments != null) { builder.append(StringUtils.join(arguments, ", ")); }// w w w .ja va 2 s .c om builder.append(").").append(SUCCESS_SUFFIX); return builder.toString(); }
From source file:Main.java
public static String showByteArray(byte[] data) { if (null == data) { return null; }//w ww . ja v a2 s.c o m StringBuilder sb = new StringBuilder("{"); for (byte b : data) { sb.append(b).append(","); } sb.deleteCharAt(sb.length() - 1); sb.append("}"); return sb.toString(); }
From source file:Main.java
private static Class<?> getActivityClass(Context context, Class<?> classObj) { StringBuilder b = new StringBuilder(255); b.append(context.getPackageName()); b.append("."); b.append(classObj.getSimpleName());//from w ww . ja v a2 s. c om b.append("Ext"); String extClassName = b.toString(); try { Class<?> extClass = Class.forName(extClassName); return extClass; } catch (ClassNotFoundException e) { //e.printStackTrace(); // DEBUG: uncomment to debug return classObj; } }
From source file:Main.java
public static String factEntryToHTML(Map.Entry<String, String> fact) { StringBuilder out = new StringBuilder("<table><tr><td>"); out.append("<h3>").append(fact.getKey()).append("</h3>"); out.append("</td></tr>"); out.append("<tr><td>"); out.append("<h4>").append(fact.getValue()).append("</h4>"); out.append("</td></tr>"); out.append("</table>"); return out.toString(); }
From source file:Main.java
/** Creates SELECT COUNT(*) with a trailing space. */ public static String createSqlSelectCountStar(String tablename, String tableAliasOrNull) { StringBuilder builder = new StringBuilder("SELECT COUNT(*) FROM "); builder.append('"').append(tablename).append('"').append(' '); if (tableAliasOrNull != null) { builder.append(tableAliasOrNull).append(' '); }/*from w w w.j a v a 2 s . c om*/ return builder.toString(); }
From source file:Main.java
public static void appendGmtOffset(StringBuilder sb, final int gmtOffset) { sb.append("GMT"); if (gmtOffset < 0) { sb.append('-'); } else {/*from w w w . j a v a2 s .c om*/ sb.append('+'); } final int p = Math.abs(gmtOffset); sb.append(p / DateUtils.HOUR_IN_MILLIS); // Hour final int min = (p / (int) DateUtils.MINUTE_IN_MILLIS) % 60; if (min != 0) { // Show minutes if non-zero sb.append(':'); if (min < 10) { sb.append('0'); } sb.append(min); } }
From source file:Main.java
public static String append(CharSequence... arr) { StringBuilder builder = new StringBuilder(); for (CharSequence s : arr) { builder.append(s); }//from w ww . jav a 2 s . com return builder.toString(); }
From source file:Main.java
private static String sqlCreateIndex(final String tableName, final String[] columnNames) { final StringBuilder buff = new StringBuilder(128); buff.append("CREATE INDEX IF NOT EXISTS idx_"); buff.append(tableName);/*w ww . j a v a2s . c o m*/ for (int i = 0; i < columnNames.length; i++) { buff.append('_'); buff.append(columnNames[i]); } buff.append(" ON "); buff.append(tableName); buff.append('('); for (int i = 0; i < columnNames.length; i++) { if (i > 0) { buff.append(','); } buff.append(columnNames[i]); } buff.append(')'); return buff.toString(); }