You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
737 B
27 lines
737 B
9 years ago
|
package com.fr.plugin.widget.ztree.tools;
|
||
|
|
||
6 years ago
|
import com.fanruan.api.util.ArrayKit;
|
||
|
import com.fanruan.api.util.StringKit;
|
||
9 years ago
|
|
||
|
/**
|
||
|
* Created by richie on 15/11/18.
|
||
|
*/
|
||
|
public class ZTreeHelper {
|
||
|
|
||
|
public static String join(String[] arr, String delimiter) {
|
||
6 years ago
|
if (ArrayKit.isEmpty(arr)) {
|
||
|
return StringKit.EMPTY;
|
||
9 years ago
|
}
|
||
|
StringBuilder sb = new StringBuilder();
|
||
6 years ago
|
for (int i = 0, len = ArrayKit.getLength(arr); i < len ; i++) {
|
||
9 years ago
|
String segment = arr[i];
|
||
6 years ago
|
if (StringKit.isNotEmpty(segment)) {
|
||
9 years ago
|
sb.append(segment);
|
||
|
if (i != len - 1) {
|
||
|
sb.append(delimiter);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return sb.toString();
|
||
|
}
|
||
|
}
|