Back to project page qiniu-android.
The source code is released under:
MIT License
If you think the Android project qiniu-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.qiniu.android.utils; /*www .jav a2 s .c o m*/ public final class StringUtils { public static String join(String[] array, String sep) { if (array == null) { return null; } int arraySize = array.length; int sepSize = 0; if (sep != null && !sep.equals("")) { sepSize = sep.length(); } int bufSize = (arraySize == 0 ? 0 : ((array[0] == null ? 16 : array[0].length()) + sepSize) * arraySize); StringBuilder buf = new StringBuilder(bufSize); for (int i = 0; i < arraySize; i++) { if (i > 0) { buf.append(sep); } if (array[i] != null) { buf.append(array[i]); } } return buf.toString(); } // no null in array public static String jsonJoin(String[] array) { int arraySize = array.length; int bufSize = arraySize * (array[0].length() + 3); StringBuilder buf = new StringBuilder(bufSize); for (int i = 0; i < arraySize; i++) { if (i > 0) { buf.append(','); } buf.append('"'); buf.append(array[i]); buf.append('"'); } return buf.toString(); } }