public static String join(String[] args, String sep) { return ApacheCommonsLangUtil.join(args, sep); } public static String join(String[] args, char sep) {
public static String join(Collection<String> args) { return ApacheCommonsLangUtil.join(args, " "); } public static String join(Collection<String> args, String sep) {
public static String join(Collection<String> args, String sep) { return ApacheCommonsLangUtil.join(args, sep); } public static String join(String[] args) {
public static String join(String[] args, int index, char sep) { return ApacheCommonsLangUtil.join(args, sep, index, args.length); }
return null; return join(array, separator, 0, array.length);
return null; return join(array, separator, 0, array.length);
return null; return join(array, separator, 0, array.length);
/** * <p>Joins the elements of the provided array into a single String * containing the provided list of elements.</p> * * <p>No delimiter is added before or after the list. * Null objects or empty strings within the array are represented by * empty strings.</p> * * <pre> * StringUtils.join(null, *) = null * StringUtils.join([], *) = "" * StringUtils.join([null], *) = "" * StringUtils.join(["a", "b", "c"], ';') = "a;b;c" * StringUtils.join(["a", "b", "c"], null) = "abc" * StringUtils.join([null, "", "a"], ';') = ";;a" * </pre> * * @param array the array of values to join together, may be null * @param separator the separator character to use * @return the joined String, {@code null} if null array input * @since 2.0 */ public static String join(final Object[] array, final char separator) { if (array == null) { return null; } return join(array, separator, 0, array.length); }
/** * <p>Joins the elements of the provided array into a single String * containing the provided list of elements.</p> * * <p>No delimiter is added before or after the list. * A {@code null} separator is the same as an empty String (""). * Null objects or empty strings within the array are represented by * empty strings.</p> * * <pre> * StringUtils.join(null, *) = null * StringUtils.join([], *) = "" * StringUtils.join([null], *) = "" * StringUtils.join(["a", "b", "c"], "--") = "a--b--c" * StringUtils.join(["a", "b", "c"], null) = "abc" * StringUtils.join(["a", "b", "c"], "") = "abc" * StringUtils.join([null, "", "a"], ',') = ",,a" * </pre> * * @param array the array of values to join together, may be null * @param separator the separator character to use, null treated as "" * @return the joined String, {@code null} if null array input */ public static String join(final Object[] array, final String separator) { if (array == null) { return null; } return join(array, separator, 0, array.length); }
return null; return join(array, separator, 0, array.length);
return null; return join(array, separator, 0, array.length);
return null; return join(array, separator, 0, array.length);
return null; return join(array, separator, 0, array.length);
/** * <p>Joins the elements of the provided {@code Iterable} into * a single String containing the provided elements.</p> * * <p>No delimiter is added before or after the list. Null objects or empty * strings within the iteration are represented by empty strings.</p> * * <p>See the examples here: {@link #join(Object[],char)}. </p> * * @param iterable the {@code Iterable} providing the values to join together, may be null * @param separator the separator character to use * @return the joined String, {@code null} if null iterator input * @since 2.3 */ public static String join(final Iterable<?> iterable, final char separator) { if (iterable == null) { return null; } return join(iterable.iterator(), separator); }
/** * <p>Joins the elements of the provided {@code Iterable} into * a single String containing the provided elements.</p> * * <p>No delimiter is added before or after the list. * A {@code null} separator is the same as an empty String ("").</p> * * <p>See the examples here: {@link #join(Object[],String)}. </p> * * @param iterable the {@code Iterable} providing the values to join together, may be null * @param separator the separator character to use, null treated as "" * @return the joined String, {@code null} if null iterator input * @since 2.3 */ public static String join(final Iterable<?> iterable, final String separator) { if (iterable == null) { return null; } return join(iterable.iterator(), separator); }
/** * <p>Joins the elements of the provided array into a single String * containing the provided list of elements.</p> * * <p>No separator is added to the joined String. * Null objects or empty strings within the array are represented by * empty strings.</p> * * <pre> * StringUtils.join(null) = null * StringUtils.join([]) = "" * StringUtils.join([null]) = "" * StringUtils.join(["a", "b", "c"]) = "abc" * StringUtils.join([null, "", "a"]) = "a" * </pre> * * @param <T> the specific type of values to join together * @param elements the values to join together, may be null * @return the joined String, {@code null} if null array input * @since 2.0 * @since 3.0 Changed signature to use varargs */ @SafeVarargs public static <T> String join(final T... elements) { return join(elements, null); }
default BaseCommand getBaseCommand(String[] args) { BaseCommand command = getDefCommand(); for (int i = args.length; i >= 0; i--) { String checkSub = ApacheCommonsLangUtil.join(args, " ", 0, i).toLowerCase(); Set<RegisteredCommand> registeredCommands = getSubCommands().get(checkSub); if (!registeredCommands.isEmpty()) { command = registeredCommands.iterator().next().scope; break; } } return command; }
/** * Gets all subcommands which are possible to tabcomplete. * * @param issuer * The command issuer. * @param args * * @return */ List<String> getCommandsForCompletion(CommandIssuer issuer, String[] args) { final Set<String> cmds = new HashSet<>(); final int cmdIndex = Math.max(0, args.length - 1); String argString = ApacheCommonsLangUtil.join(args, " ").toLowerCase(); for (Map.Entry<String, RegisteredCommand> entry : subCommands.entries()) { final String key = entry.getKey(); if (key.startsWith(argString) && !CATCHUNKNOWN.equals(key) && !DEFAULT.equals(key)) { final RegisteredCommand value = entry.getValue(); if (!value.hasPermission(issuer) || value.isPrivate) { continue; } String[] split = ACFPatterns.SPACE.split(value.prefSubCommand); cmds.add(split[cmdIndex]); } } return new ArrayList<>(cmds); }
String checkSub = ApacheCommonsLangUtil.join(args, " ", 0, i).toLowerCase(); Set<RegisteredCommand> cmds = subCommands.get(checkSub);
String prefSubCommand = ApacheCommonsLangUtil.join(subCommandParts, " "); final String[] aliasNames = manager.getAnnotations().getAnnotationValues(method, CommandAlias.class, Annotations.REPLACEMENTS | Annotations.LOWERCASE);