Example usage for java.lang StringBuilder toString

List of usage examples for java.lang StringBuilder toString

Introduction

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

Prototype

@Override
    @HotSpotIntrinsicCandidate
    public String toString() 

Source Link

Usage

From source file:Main.java

private static String getSpString(String mobile, String username, String password) {
    StringBuilder builder = new StringBuilder();
    builder.append(mobile).append(SPLIT_CHAR).append(username).append(SPLIT_CHAR).append(password);
    return builder.toString();
}

From source file:com.autentia.common.util.StringUtils.java

public static String trimBrackets(String stringToTrim) {

    final StringBuilder result = new StringBuilder(stringToTrim);

    while (result.toString().startsWith("[")) {
        result.deleteCharAt(0);/*from  ww w  . ja v  a  2s. c o  m*/
    }
    while (result.toString().endsWith("]")) {
        result.deleteCharAt(result.length() - 1);
    }

    return result.toString();
}

From source file:Main.java

public static String readFromSD(String fileName) throws Exception {
    File file = new File(Environment.getExternalStorageDirectory(), fileName);

    FileReader fr = new FileReader(file);
    BufferedReader br = new BufferedReader(fr);
    String line = null;/*from   w w w . j av  a  2 s . c om*/
    StringBuilder sb = new StringBuilder();

    while ((line = br.readLine()) != null) {
        sb.append(line);
    }
    return sb.toString();
}

From source file:Main.java

public static String leftPad(String source, int size, String s) {
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < size; i++)
        builder.append(s);/*  w  ww.j  a  v  a 2  s. co  m*/
    builder.append(source);
    return builder.toString();
}

From source file:Main.java

public static String addFaceTag(String faceId) {
    StringBuilder builder = new StringBuilder();
    builder.append(TAG_FACE);//  w ww .  j  a  v  a  2  s . c  o m
    builder.append(faceId);
    builder.append(TAG_END);
    return builder.toString();

}

From source file:Main.java

public static String join(String[] array, String delimiter) {
    StringBuilder sb = new StringBuilder();
    for (String str : array) {
        sb.append(str);//from www. j ava  2  s. co  m
        sb.append(delimiter);
    }
    return sb.toString();
}

From source file:Main.java

public static String readAll(Reader rd) throws IOException {
    StringBuilder sb = new StringBuilder();
    int cp;//  ww w  . java 2 s  .  co  m
    while ((cp = rd.read()) != -1) {
        sb.append((char) cp);
    }
    return sb.toString();
}

From source file:Main.java

private static String getRandomNumber(int digCount) {
    StringBuilder sb = new StringBuilder(digCount);
    for (int i = 0; i < digCount; i++) {
        sb.append((rnd.nextInt(10)));/*ww w. java 2  s  . c om*/
    }
    return sb.toString();
}

From source file:Main.java

private static String join(List<? extends Object> collection) {
    StringBuilder result = new StringBuilder();
    for (Object object : collection)
        result.append(object.toString());
    return result.toString();
}

From source file:Main.java

public static String getClassFullName(String pkg, String name) {
    StringBuilder sb = new StringBuilder();
    if (pkg.length() != 0) {
        sb.append(pkg).append(".");
    }//from  w ww.j av  a  2s.  com
    sb.append(name);
    return sb.toString();
}