public static String capitalize(String str, char[] delimiters) { return ApacheCommonsLangUtil.capitalize(str, delimiters); } private static boolean isDelimiter(char ch, char[] delimiters) {
public static String ucfirst(String str) { return ApacheCommonsLangUtil.capitalizeFully(str); }
/** * <p>Tests if the list of method names used in the search for <code>Throwable</code> * objects include the given name.</p> * * @param methodName the methodName to search in the list. * @return if the list of method names used in the search for <code>Throwable</code> * objects include the given name. * @since 2.1 */ public static boolean isCauseMethodName(String methodName) { return ApacheCommonsLangUtil.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0; }
public static String join(Collection<String> args) { return ApacheCommonsLangUtil.join(args, " "); } public static String join(Collection<String> args, String sep) {
/** * Gets the actual args in string form the user typed * This returns a list of all tab complete options which are possible with the given argument and commands. * @param arg * Argument which was pressed tab on. * @param cmds * The possibilities to return. * * @return All possible options. This may be empty. */ private static List<String> filterTabComplete(String arg, List<String> cmds) { return cmds.stream() .distinct() .filter(cmd -> cmd != null && (arg.isEmpty() || ApacheCommonsLangUtil.startsWithIgnoreCase(cmd, arg))) .collect(Collectors.toList()); }
private static boolean isDelimiter(char ch, char[] delimiters) { return ApacheCommonsLangUtil.isDelimiter(ch, delimiters); }
@Override public void execute(CommandIssuer issuer, String commandLabel, String[] args) { command.execute(issuer, commandLabel, ApacheCommonsLangUtil.addAll(baseArgs, args)); }
public static boolean isNumber(String str) { return ApacheCommonsLangUtil.isNumeric(str); }
/** * <p>Check if a CharSequence starts with a specified prefix (optionally case insensitive).</p> * * @see java.lang.String#startsWith(String) * @param str the CharSequence to check, may be null * @param prefix the prefix to find, may be null * @param ignoreCase indicates whether the compare should ignore case * (case insensitive) or not. * @return {@code true} if the CharSequence starts with the prefix or * both {@code null} */ private static boolean startsWith(final CharSequence str, final CharSequence prefix, final boolean ignoreCase) { if (str == null || prefix == null) { return str == null && prefix == null; } if (prefix.length() > str.length()) { return false; } return regionMatches(str, ignoreCase, 0, prefix, 0, prefix.length()); }
public static String join(Collection<String> args, String sep) { return ApacheCommonsLangUtil.join(args, sep); } public static String join(String[] args) {
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) { String name = player.getName(); if (ApacheCommonsLangUtil.startsWithIgnoreCase(name, input)) { matchedPlayers.add(name);
for (int i = 0; i < buffer.length; i++) { final char ch = buffer[i]; if (isDelimiter(ch, delimiters)) { capitalizeNext = true; } else if (capitalizeNext) {
@Override public List<String> tabComplete(CommandIssuer issuer, String alias, String[] args) throws IllegalArgumentException { return command.tabComplete(issuer, alias, ApacheCommonsLangUtil.addAll(baseArgs, args)); }
public static String join(String[] args, String sep) { return ApacheCommonsLangUtil.join(args, sep); } public static String join(String[] args, char sep) {
/** * <p>Capitalizes all the whitespace separated words in a String. * Only the first character of each word is changed. To convert the * rest of each word to lowercase at the same time, * use {@link #capitalizeFully(String)}.</p> * * <p>Whitespace is defined by {@link Character#isWhitespace(char)}. * A <code>null</code> input String returns <code>null</code>. * Capitalization uses the Unicode title case, normally equivalent to * upper case.</p> * * <pre> * WordUtils.capitalize(null) = null * WordUtils.capitalize("") = "" * WordUtils.capitalize("i am FINE") = "I Am FINE" * </pre> * * @param str the String to capitalize, may be null * @return capitalized String, <code>null</code> if null String input * @see #capitalizeFully(String) */ public static String capitalize(final String str) { return capitalize(str, null); }
/** * <p>Finds the index of the given object in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param objectToFind the object to find, may be <code>null</code> * @return the index of the object within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(Object[] array, Object objectToFind) { return indexOf(array, objectToFind, 0); }
/** * <p>Converts all the whitespace separated words in a String into capitalized words, * that is each word is made up of a titlecase character and then a series of * lowercase characters. </p> * * <p>Whitespace is defined by {@link Character#isWhitespace(char)}. * A <code>null</code> input String returns <code>null</code>. * Capitalization uses the Unicode title case, normally equivalent to * upper case.</p> * * <pre> * WordUtils.capitalizeFully(null) = null * WordUtils.capitalizeFully("") = "" * WordUtils.capitalizeFully("i am FINE") = "I Am Fine" * </pre> * * @param str the String to capitalize, may be null * @return capitalized String, <code>null</code> if null String input */ public static String capitalizeFully(final String str) { return capitalizeFully(str, null); }
public static String join(String[] args, int index, char sep) { return ApacheCommonsLangUtil.join(args, sep, index, args.length); }
return capitalize(str, delimiters);