List of usage examples for java.lang StringBuilder StringBuilder
public StringBuilder(CharSequence seq)
From source file:Main.java
public static String getAtLeastOne(StringTokenizer stringT) { StringBuilder text = new StringBuilder(stringT.nextToken()); while (stringT.hasMoreTokens()) { text.append(' '); text.append(stringT.nextToken()); }// www. j a v a2 s . c o m return text.toString(); }
From source file:Main.java
public static String getNtripString(String ggaString, String mountPoint, String base64password) { StringBuilder result = new StringBuilder("GET /"); result.append(mountPoint);/* w ww. j a va2s .co m*/ result.append( " HTTP/1.0\r\nUser-Agent: NTRIP goGPSprojectJava\r\nAccept: */*\r\nConnection: close\r\nAuthorization: Basic "); result.append(base64password); result.append("\r\n\r\n"); return result.toString(); }
From source file:Main.java
public static String byteArrayToHexString(byte[] b, int start, int stop) { String stmp = ""; StringBuilder sb = new StringBuilder(""); for (int n = start; n <= stop; n++) { stmp = Integer.toHexString(b[n] & 0xFF); sb.append((stmp.length() == 1) ? "0" + stmp : stmp); //sb.append(" "); }/*w w w .jav a2 s . com*/ System.out.println("deviceinfo :" + sb); return sb.toString().toUpperCase().trim(); }
From source file:Main.java
public static String capitalizeFirstChar(String target) { StringBuilder capitalized = new StringBuilder(target); capitalized.setCharAt(0, Character.toUpperCase(capitalized.charAt(0))); return capitalized.toString(); }
From source file:Main.java
public static String makeQuestionmarks(int n) { if (n <= 0) { return ""; }//from www. j a va2 s . co m StringBuilder builder = new StringBuilder("?"); for (int i = 1; i < n; i++) { builder.append(",?"); } return builder.toString(); }
From source file:Main.java
public static String map2Str(Map<String, String> map) { StringBuilder sb = new StringBuilder(""); Set<String> keys = map.keySet(); for (String key : keys) sb.append(key + ":" + map.get(key) + ", "); String s = sb.toString().trim(); if (!s.endsWith(",")) return s; else// www . j a va 2 s . c o m return s.substring(0, s.lastIndexOf(",") - 1); }
From source file:Main.java
static public void saveCrashTrace(Throwable ex) { StackTraceElement[] elements = ex.getStackTrace(); StringBuilder builder = new StringBuilder(ex.getMessage()); for (StackTraceElement ele : elements) { builder.append('\n').append(ele.toString()); }/* w ww.jav a 2s . c o m*/ android.util.Log.e("crash", builder.toString()); }
From source file:Main.java
public static String getHex(byte[] paramArrayOfByte) { StringBuilder localStringBuilder = new StringBuilder(2 * paramArrayOfByte.length); int i = paramArrayOfByte.length; for (int j = 0; j < i; j++) { int k = paramArrayOfByte[j]; localStringBuilder.append("0123456789ABCDEF".charAt((k & 0xF0) >> 4)) .append("0123456789ABCDEF".charAt(k & 0xF)); }/*from w w w. jav a2 s.com*/ return localStringBuilder.toString(); }
From source file:Main.java
public static String increment(boolean increment, String table, String column, long _id) { return new StringBuilder("UPDATE ").append(table).append(" ").append(" SET ").append(column).append("=") .append(column).append(increment ? "+1" : "-1").append(" WHERE ").append(BaseColumns._ID) .append("=").append(_id).toString(); }
From source file:Main.java
public static String noMarkup(String text) { if (text == null) return null; StringBuilder sb = new StringBuilder(text.length()); boolean inMarkup = false; for (int i = 0, len = text.length(); i < len; ++i) { char c = text.charAt(i); if (inMarkup) { if (c == '>') inMarkup = false;/*ww w. jav a 2 s . co m*/ } else { if (c == '<') inMarkup = true; else sb.append(c); } } return sb.toString(); }