Example usage for java.lang StringBuffer append

List of usage examples for java.lang StringBuffer append

Introduction

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

Prototype

@Override
    public synchronized StringBuffer append(double d) 

Source Link

Usage

From source file:br.fgv.util.EmailSender.java

public static void enviarEmail(String body, String subject) throws EmailException {

    StringBuffer sb = new StringBuffer("");
    sb.append(body);

    Email email = new SimpleEmail();
    email.setHostName("smtp.gmail.com");

    email.setDebug(true);/*from   w  ww .j  a va  2s .c om*/
    email.setSSLOnConnect(true);

    email.addTo("wesley.seidel@gmail.com");

    email.setAuthentication("wseidel.fgv", "batavinhofgv");

    email.setFrom("wseidel.fgv@gmail.com");
    email.setSubject(subject);
    email.setMsg(sb.toString());

    email.send();
}

From source file:Main.java

/**
 * //  ww w  .  j a va 2 s  . c om
 * @param emojiName
 * @return
 */
public static String formatFaces(String emojiName) {
    StringBuffer sb = new StringBuffer();
    sb.append("<img src=\"emoji_");
    sb.append(emojiName);
    sb.append("\">");
    return sb.toString();
}

From source file:Main.java

public static StringBuffer appendElementEnd(StringBuffer p_buffer, String p_name) {
    p_buffer.append("</");
    p_buffer.append(p_name);//from   w  w  w.  java 2s. com
    p_buffer.append(">");
    // appendLine(p_buffer);
    return p_buffer;
}

From source file:Main.java

public static String getDeditPaymentXml(String cardHolder, String cardNum, String cardSec, String cardExp,
        String cardPin) {// w w  w.j  av  a2 s  .  com
    StringBuffer buffer = new StringBuffer();
    buffer.append("<payment>");
    buffer.append("<type>Dedit</type>");
    buffer.append("<cardHolder>" + cardHolder + "</cardHolder>");
    buffer.append("<cardNum>" + cardNum + "</cardNum>");
    buffer.append("<cardSec>" + cardSec + "</cardSec>");
    buffer.append("<cardExp>" + cardExp + "</cardExp>");
    buffer.append("<cardPin>" + cardPin + "</cardPin>");
    buffer.append("</payment>");

    return buffer.toString();
}

From source file:Main.java

public static String getColorText(String text, String colorValue) {
    StringBuffer sb = new StringBuffer("<font color=\"#");
    return sb.append(colorValue).append("\">").append(text).append("</font>").toString();
}

From source file:Main.java

public static String getRequestUrl(String id, String secret, String com, String number, String encode) {
    StringBuffer resultUrl = new StringBuffer();
    resultUrl.append("http://api.ickd.cn/?id=" + (id != null ? id : xfid));
    resultUrl.append("&secret=" + (secret != null ? secret : xfsecret));
    resultUrl.append("&com=" + com);
    resultUrl.append("&nu=" + number);
    resultUrl.append("&encode=" + (encode != null ? encode : "gbk") + "&ord=asc");
    Log.i(TAG, "Request URL:" + resultUrl);
    return resultUrl.toString();
}

From source file:Main.java

public static String maskCardNumber(String clearcardnumber) throws Exception {

    if (clearcardnumber.length() < 10) {
        throw new Exception("Invalid number of digits");
    }/* w ww. j  a v a2s .c o m*/

    int length = clearcardnumber.length();

    String prefix = clearcardnumber.substring(0, 4);
    String suffix = clearcardnumber.substring(length - 4);

    StringBuffer mask = new StringBuffer();
    mask.append(prefix).append("XXXXXXXXXX").append(suffix);

    return mask.toString();
}

From source file:Main.java

public static String getThreadId() {
    StringBuffer sb = new StringBuffer(30);
    sb.append("[thread Id: ").append(Thread.currentThread().getId()).append("] ");
    return sb.toString();
}

From source file:Main.java

public static String limitLenOfStr(String str, int maxLen) {

    if (null != str && str.length() > maxLen) {

        StringBuffer sb = new StringBuffer();

        sb.append(str.substring(0, maxLen));
        sb.append("...");

        return sb.toString();
    }/*from w ww.ja v  a 2 s .  c o  m*/

    return str;
}

From source file:Main.java

public static String getJsonMessageMass(String msgId) {
    StringBuffer sb = new StringBuffer();
    sb.append("{");
    sb.append("\"msg_id\":\"").append(msgId).append("\"");
    sb.append("}");
    return sb.toString();
}