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

public static String asCdata(String data) {
    StringBuilder sb = new StringBuilder(data.length() + CDATA_LENGTH);
    sb.append(CDATA_OPEN).append(data).append(CDATA_CLOSE);
    return sb.toString();
}

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 joinArray(String[] array, String separator) {
    if (null == array || array.length <= 0) {
        return "";
    }/*from   w  ww.  j  av a2 s .co m*/
    StringBuilder sb = new StringBuilder();
    for (String s : array) {
        sb.append(separator).append(s);
    }
    return sb.toString().substring(separator.length());
}

From source file:Main.java

public static String smaliPrimitiveToJavaWrapper(String className) {
    String javaWrapper = smaliPrimitiveToJavaWrapper.get(getBaseClass(className));
    if (null == javaWrapper) {
        return null;
    }/*from   w ww  . j a  v  a 2s  .com*/

    if (!className.startsWith("[")) {
        return javaWrapper;
    }

    int lastIndex = className.lastIndexOf('[');
    String dimens = className.substring(0, lastIndex + 1);
    StringBuilder sb = new StringBuilder(dimens);
    sb.append('L').append(javaWrapper).append(';');

    return sb.toString();
}

From source file:Main.java

public static String getStringByStringBuilder(String... strings) {
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
        builder.append(string);//from www  . j a  v a  2s .c o  m
    }
    return builder.toString();
}

From source file:Main.java

public static String makeHtmlSpace(int number) {
    final String space = "&nbsp;";
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < number; i++) {
        result.append(space);//from   w w w . j av a2s.  c o m
    }
    return result.toString();
}

From source file:Main.java

/**
 * Get the direct text content of an element.
 *
 * @param element/*from   w ww. j  a va  2s . co  m*/
 *            The element.
 *
 * @return The contained text.
 */
public static String getText(final Element element) {
    final StringBuilder sbuf = new StringBuilder();

    getText(element, sbuf, false);

    return sbuf.toString();
}

From source file:com.jivesoftware.os.amza.service.AmzaSetStress.java

public static String document(long id) {
    StringBuilder document = new StringBuilder();
    document.append(id);/*from w  w w.  ja v a  2s.  c  om*/
    return document.toString();
}

From source file:Main.java

public static String addStrings(Object... params) {
    StringBuilder stringBuilder = new StringBuilder();
    for (Object s : params) {
        stringBuilder.append(s);/*  w  w  w.  ja v a2s.  c  om*/
    }
    return stringBuilder.toString();

}

From source file:Main.java

/**
 * Internal methods to generate a string with a specified length
 * //from w w  w .  jav a 2s. c o  m
 * @param l
 *            String length
 * @return Generated string
 */
private static String generateFixedLengthString(int l) {
    StringBuilder buffer = new StringBuilder();
    for (int i = 1; i <= l; i++) {
        buffer.append("X");
    }
    return buffer.toString();
}