forked from IF-LK-2020/array
join
This commit is contained in:
10
Arrays.java
10
Arrays.java
@@ -261,8 +261,18 @@ public class Arrays {
|
||||
* Für ein leeres Array wird ein leerer String zurück gegeben.
|
||||
*/
|
||||
public String join( String[] pArray, String pSep ) {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt vor jeden String im Array das Prefix <var>pPrefix</var> und gibt
|
||||
|
||||
Reference in New Issue
Block a user