The input string with more uppercase
*/ @NotNull - private String uppercaseFirst(@NotNull String input) { + private String uppercaseFirstEachWord(@NotNull String input) { String[] parts = input.split(" "); for (int i = 0; i < parts.length; i++) { parts[i] = parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1); diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/InputParsingUtil.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/InputParsingUtil.java index 662cf21..dd7a4e2 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/InputParsingUtil.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/utility/InputParsingUtil.java @@ -32,47 +32,6 @@ public final class InputParsingUtil { return input.matches("[0-9]+"); } - /** - * Merges all arguments to a string with spaces - * - * @param argumentsThe arguments to merge
- * @param stripLastNHow many of the last arguments to ignore
- * @returnThe merged arguments
- */ - @NotNull - public static String mergeArguments(@NotNull String[] arguments, int stripLastN) { - return mergeArguments(0, arguments, stripLastN); - } - - /** - * Merges all arguments to a string with spaces - * - * @param stripFirstNHow many of the first arguments to ignore
- * @param argumentsThe arguments to merge
- * @returnThe merged arguments
- */ - @NotNull - public static String mergeArguments(int stripFirstN, @NotNull String[] arguments) { - return mergeArguments(stripFirstN, arguments, 0); - } - - /** - * Merges all arguments to a string with spaces - * - * @param stripFirstNHow many of the first arguments to ignore
- * @param argumentsThe arguments to merge
- * @param stripLastNHow many of the last arguments to ignore
- * @returnThe merged arguments
- */ - @NotNull - public static String mergeArguments(int stripFirstN, @NotNull String[] arguments, int stripLastN) { - StringBuilder builder = new StringBuilder(arguments[stripFirstN]); - for (int i = stripFirstN + 1; i < arguments.length - stripLastN; i++) { - builder.append(" ").append(arguments[i]); - } - return builder.toString(); - } - /** * Parses a page number for a string like "page1" * diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/IntegerToRomanUtil.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/IntegerToRomanUtil.java deleted file mode 100644 index 50a9715..0000000 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/IntegerToRomanUtil.java +++ /dev/null @@ -1,94 +0,0 @@ -package net.knarcraft.bookswithoutborders.utility; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -/** - * A utility for converting from an integer to a roman numeral - */ -public final class IntegerToRomanUtil { - - private final static ListThe number to convert
- * @returnThe roman representation of the number
- */ - @NotNull - public static String getRomanNumber(int number) { - StringBuilder output = new StringBuilder(); - int remainder = number; - for (int i = 0; i < romanCharacters.size(); i++) { - int romanValue = romanValues.get(i); - char romanCharacter = romanCharacters.get(i); - - // Repeat the roman character, and calculate the new remainder - if (remainder >= romanValue) { - output.append(repeat(romanCharacter, remainder / romanValue)); - remainder = remainder % romanValue; - } - - // Exit early to prevent unexpected trailing characters - if (remainder == 0) { - return output.toString(); - } - - // Generate the special case IV and similar - for (int j = i; j < romanCharacters.size(); j++) { - int value = romanValues.get(j); - int difference = Math.max(romanValue - value, 0); - - /* If the remainder is "one" less than the current roman value, we hit the IV/IX/XL case. - Note that 5 triggers the special case when 10 is tested, as 5 = 10 - 5, which requires a test, so it - can be filtered out. */ - if (remainder == difference && value != romanValue / 2) { - output.append(romanCharacters.get(j)).append(romanCharacter); - remainder = 0; - } - } - } - - return output.toString(); - } - - /** - * Repeats the given character - * - * @param characterThe character to repeat
- * @param timesThe number of times to repeat the character
- * @returnThe repeated string
- */ - @NotNull - private static String repeat(char character, int times) { - return String.valueOf(character).repeat(Math.max(0, times)); - } - -} diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionTypeUtil.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionTypeUtil.java index 58b2f1e..5565e91 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionTypeUtil.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/utility/TabCompletionTypeUtil.java @@ -20,10 +20,7 @@ public final class TabCompletionTypeUtil { */ @NotNull public static ListThe arguments given by the user
- * @param filteredTab-completions filtered by user input
- * @param offsetThe offset to use, if other arguments are preceding the book specification
- * @param prefixThe prefix to use before each tab-completion
- * @returnThe cleaned tab-completions
- */ - @NotNull - public static List