Example usage for java.lang StringBuffer toString

List of usage examples for java.lang StringBuffer toString

Introduction

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

Prototype

@Override
    @HotSpotIntrinsicCandidate
    public synchronized String toString() 

Source Link

Usage

From source file:Main.java

public static String nsElement(String p_namespace, String p_elem_name) {
    StringBuffer l_buf = new StringBuffer();

    l_buf.append(p_namespace).append(":").append(p_elem_name);

    return l_buf.toString();

}

From source file:Main.java

public static String formathhmmss(String hhmmss) {
    if (null != hhmmss && hhmmss.length() == 6) {
        StringBuffer sb = new StringBuffer(hhmmss);
        sb.insert(2, ":");
        sb.insert(5, ":");
        return sb.toString();
    }// w ww . j  ava  2  s . co m

    return "";
}

From source file:MemoryUtils.java

public static void printMemoryInfo() {
    StringBuffer buffer = getMemoryInfo();
    logger.info(buffer.toString());
}

From source file:AlignX.java

private static String makeLabel(String s, int length) {
    StringBuffer buff = new StringBuffer(length);
    for (int i = 0; i < length; i++) {
        buff.append(s);/*from ww w .  j  a  va  2s . c  o m*/
    }
    return buff.toString();
}

From source file:Main.java

public static String convertBase64ToIso2022(String str) {
    if (str == null || str.length() <= 0) {
        return str;
    }//  w w w  .j a  v a 2 s  .co  m

    StringBuffer sb = new StringBuffer("=?ISO-2022-JP?B?");
    sb.append(str).append("?=");

    return sb.toString();
}

From source file:Main.java

public static String getCookie(ArrayList<String> lt) {
    StringBuffer sb = new StringBuffer();
    for (String s : lt) {
        sb.append(s).append(";");
    }//from  ww w.  j a  va2  s . c  o m
    return sb.toString();
}

From source file:Main.java

static String makeXMLCloseElement(String elementName) {
    StringBuffer sb = new StringBuffer();
    sb.append("</");
    sb.append(elementName);/* w w w . j av a2  s.c om*/
    sb.append(">");
    return sb.toString();
}

From source file:Main.java

protected static String pad(int cols) {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < cols; i++)
        sb.append(' ');
    return sb.toString();
}

From source file:ReverseStringTest.java

public static String reverseIt(String source) {
    int i, len = source.length();
    StringBuffer dest = new StringBuffer(len);

    for (i = (len - 1); i >= 0; i--)
        dest.append(source.charAt(i));//  w ww.  ja v a  2  s  .co  m
    return dest.toString();
}

From source file:Main.java

/**
 * /*w w  w  .  j  av a 2  s .  c  o m*/
 * @param n
 * @param name
 * @param sbStrings
 * this function aims at grabbing all title strings under current sourceOfNode. 
 * @return
 */
public static String getNodeStringsByName(Node n, String name, StringBuffer sbStrings) {
    NodeList l = n.getChildNodes();
    if (l == null)
        return sbStrings.toString();

    for (int i = 0; i < l.getLength(); i++) {
        if (l.item(i).getNodeName().equals(name)) {
            sbStrings.append(l.item(i).getTextContent() + " ");
        } else {
            getNodeStringsByName(l.item(i), name, sbStrings);
        }
    }
    return sbStrings.toString();
}