FileDocCategorySizeDatePackage
StringUtils.javaAPI DocAndroid 1.5 API1698Wed May 06 22:41:04 BST 2009org.apache.harmony.kernel.vm

StringUtils

public final class StringUtils extends Object
String utility functions.

Fields Summary
Constructors Summary
private StringUtils()
This class is uninstantiable.

        // This space intentionally left blank.
    
Methods Summary
public static java.lang.StringcombineStrings(java.lang.Object[] list)
Combine a list of strings in an Object[] into a single string.

param
list non-null; the strings to combine
return
non-null; the combined form

        int listLength = list.length;

        switch (listLength) {
            case 0: {
                return "";
            }
            case 1: {
                return (String) list[0];
            }
        }

        int strLength = 0;

        for (int i = 0; i < listLength; i++) {
            strLength += ((String) list[i]).length();
        }

        StringBuilder sb = new StringBuilder(strLength);
        
        for (int i = 0; i < listLength; i++) {
            sb.append(list[i]);
        }
        
        return sb.toString();