use built-in TextUtils.join instead of StringBuilder
This commit is contained in:
parent
7ae3a15d7c
commit
572427cb57
1 changed files with 2 additions and 11 deletions
|
@ -11,6 +11,7 @@ import android.os.Build;
|
|||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
@ -99,18 +100,8 @@ public class Utility {
|
|||
public static String combine(Object[] parts, char separator) {
|
||||
if (parts == null) {
|
||||
return null;
|
||||
} else if (parts.length == 0) {
|
||||
return "";
|
||||
} else if (parts.length == 1) {
|
||||
return parts[0].toString();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(parts[0]);
|
||||
for (int i = 1; i < parts.length; ++i) {
|
||||
sb.append(separator);
|
||||
sb.append(parts[i]);
|
||||
}
|
||||
return sb.toString();
|
||||
return TextUtils.join(String.valueOf(separator), parts);
|
||||
}
|
||||
|
||||
public static String base64Decode(String encoded) {
|
||||
|
|
Loading…
Reference in a new issue