Example usage for java.lang StringBuilder append

List of usage examples for java.lang StringBuilder append

Introduction

In this page you can find the example usage for java.lang StringBuilder append.

Prototype

@Override
    public StringBuilder append(double d) 

Source Link

Usage

From source file:Main.java

public static String arrayToString(String message, ArrayList<Integer> arr) {
    StringBuilder resString = new StringBuilder();
    resString.append(message);
    for (int i : arr) {
        resString.append(i + 1).append(", ");
    }//from  w  ww . j  ava2  s .  c o  m
    resString.delete(resString.length() - 2, resString.length());
    return resString.toString();
}

From source file:Main.java

public static String getNtripString(String ggaString, String mountPoint, String base64password) {
    StringBuilder result = new StringBuilder("GET /");
    result.append(mountPoint);
    result.append(/*from   ww w  .j  av a2 s . c o m*/
            " 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 getStarMobile(String phoneNumber) {
    if (TextUtils.isEmpty(phoneNumber) || phoneNumber.length() < 11) {
        return "";
    }// w ww.  j  av a 2  s .c o  m
    StringBuilder builder = new StringBuilder();
    builder.append(phoneNumber.subSequence(0, 3));
    builder.append("****");
    builder.append(phoneNumber.subSequence(7, 11));
    return builder.toString();
}

From source file:Main.java

public static <T> String mkString(String separator, T... ss) {
    if (ss.length == 0)
        return "";
    StringBuilder sb = new StringBuilder();
    sb.append(ss[0]);
    for (int i = 1; i < ss.length; i++)
        sb.append(separator).append(ss[i]);
    return sb.toString();
}

From source file:Main.java

public static <E> String toString(Iterator<E> iterator) {
    if (iterator == null || !iterator.hasNext()) {
        return "[]";
    }//from ww  w.  j a v a2  s .  c  o m
    StringBuilder builder = new StringBuilder();
    builder.append('[');
    while (iterator.hasNext()) {
        builder.append(iterator.next()).append(',').append(' ');
    }
    return builder.append(']').toString();
}

From source file:Main.java

private static byte[] getFileEntry(String fieldName, String fileName, String mimeType, String charset)
        throws IOException {
    StringBuilder entry = new StringBuilder();
    entry.append("Content-Disposition:form-data;name=\"");
    entry.append(fieldName);//from w  ww .j a va 2 s. com
    entry.append("\";filename=\"");
    entry.append(fileName);
    entry.append("\"\r\nContent-Type:");
    entry.append(mimeType);
    entry.append("\r\n\r\n");
    return entry.toString().getBytes(charset);
}

From source file:Main.java

final public static String argbColorToHex(int alpha, int red, int green, int blue) {
    StringBuilder builder = new StringBuilder();
    builder.append(encodeToHex(alpha));
    builder.append(encodeToHex(red));/*from   w  ww  . ja va  2s . co  m*/
    builder.append(encodeToHex(green));
    builder.append(encodeToHex(blue));
    return builder.toString();
}

From source file:Main.java

public static String i(int[] iArr) {
    StringBuilder stringBuilder = new StringBuilder(32);
    stringBuilder.append('(');
    for (int append : iArr) {
        stringBuilder.append(append).append(',');
    }//w  w  w.jav a 2s . co m
    stringBuilder.setCharAt(stringBuilder.length() - 1, ')');
    return stringBuilder.toString();
}

From source file:Main.java

public static String removeBlanks(String content) {
    if (content == null) {
        return null;
    }//from www .  j  ava2s .  c  o  m
    StringBuilder buff = new StringBuilder();
    buff.append(content);
    for (int i = buff.length() - 1; i >= 0; i--) {
        if (' ' == buff.charAt(i) || ('\n' == buff.charAt(i)) || ('\t' == buff.charAt(i))
                || ('\r' == buff.charAt(i))) {
            buff.deleteCharAt(i);
        }
    }
    return buff.toString();
}

From source file:Main.java

public static String repr(Iterable<String> it) {
    StringBuilder buf = new StringBuilder();
    buf.append('[');
    String sep = "";
    for (String s : it) {
        buf.append(sep);/*from ww  w.  j a va  2  s  .  c  o m*/
        sep = ", ";
        buf.append(repr(s));
    }
    buf.append(']');
    return buf.toString();
}