Android Utililty Methods StringBuilder Append

List of utility methods to do StringBuilder Append

Description

The list of methods to do StringBuilder Append are organized into topic(s).

Method

voidappendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading)
After normalizing the whitespace within a string, appends it to a string builder.
boolean lastWasWhite = false;
boolean reachedNonWhite = false;
int len = string.length();
int c;
for (int i = 0; i < len; i += Character.charCount(c)) {
    c = string.codePointAt(i);
    if (isWhitespace(c)) {
        if ((stripLeading && !reachedNonWhite) || lastWasWhite)
...
StringBuilderappendLine(final StringBuilder s, final CharSequence line)
append Line
if (s.length() > 0) {
    s.append("\n");
s.append(line);
return s;
StringappendStr(char splitTag, Object... strs)
append Str
if (null == strs) {
    return "";
StringBuilder str = new StringBuilder();
for (Object demp : strs) {
    str.append(demp);
    str.append(splitTag);
return str.toString();
voidbyteToString(StringBuilder sb, byte b)
byte To String
int unsigned_byte = b < 0 ? b + 256 : b;
int hi = unsigned_byte / 16;
int lo = unsigned_byte % 16;
sb.append("0123456789ABCDEF".substring(hi, hi + 1));
sb.append("0123456789ABCDEF".substring(lo, lo + 1));
voidaddStartLine(Object aObject, StringBuilder aResult)
add Start Line
aResult.append(aObject.getClass().getName());
aResult.append(" {");
aResult.append(NEW_LINE);
voidappendByteAsHex(StringBuilder sb, byte b)
append Byte As Hex
int unsignedByte = b & 0xFF;
if (unsignedByte < 16) {
    sb.append("0");
sb.append(Integer.toHexString(unsignedByte));