forked from IF-LK-2020/array
join
This commit is contained in:
12
Arrays.java
12
Arrays.java
@@ -261,7 +261,17 @@ public class Arrays {
|
||||
* Für ein leeres Array wird ein leerer String zurück gegeben.
|
||||
*/
|
||||
public String join( String[] pArray, String pSep ) {
|
||||
return "";
|
||||
if (pArray == null || pArray.length == 0) {
|
||||
return "";
|
||||
}
|
||||
String str = "";
|
||||
for (int i = 0; i < pArray.length; i++) {
|
||||
str += pArray[i];
|
||||
if (i < pArray.length - 1) {
|
||||
str += pSep;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user