mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-03-12 22:49:31 +01:00
Random: Add join for an array.
This commit is contained in:
parent
3ebde69877
commit
5fe02d75d2
@ -2,6 +2,7 @@ package fr.neatmonster.nocheatplus.utilities;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -34,6 +35,28 @@ public class StringUtil {
|
||||
fdec1.setMinimumIntegerDigits(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join parts with link, starting from startIndex.
|
||||
* @param input
|
||||
* @param startIndex
|
||||
* @param link
|
||||
* @return
|
||||
*/
|
||||
public static <O extends Object> String join(O[] input, int startIndex, String link) {
|
||||
return join(Arrays.copyOfRange(input, startIndex, input.length), link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join parts with link.
|
||||
*
|
||||
* @param input
|
||||
* @param link
|
||||
* @return
|
||||
*/
|
||||
public static <O extends Object> String join(O[] input, String link) {
|
||||
return join(Arrays.asList(input), link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join parts with link.
|
||||
*
|
||||
@ -66,14 +89,14 @@ public class StringUtil {
|
||||
for (final char c : chars){
|
||||
String hex = Integer.toHexString((int) c);
|
||||
switch (hex.length()){
|
||||
case 1:
|
||||
hex = "000" + hex;
|
||||
break;
|
||||
case 2:
|
||||
hex = "00" + hex;
|
||||
break;
|
||||
case 3:
|
||||
hex = "0" + hex;
|
||||
case 1:
|
||||
hex = "000" + hex;
|
||||
break;
|
||||
case 2:
|
||||
hex = "00" + hex;
|
||||
break;
|
||||
case 3:
|
||||
hex = "0" + hex;
|
||||
}
|
||||
for (final String s : out){
|
||||
final String[] split = s.split("\\u" + hex);
|
||||
|
Loading…
Reference in New Issue
Block a user