diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-07 14:58:01 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-07 14:58:01 +0900 |
commit | 055520e1d8313a302f58babc6526d95bf22b471f (patch) | |
tree | 71e71196278b7ebda383f4ae809e2216b9fb583b /src/main | |
parent | 081bf824bbb448e6665573f7f8f531cbbe43dea0 (diff) | |
download | Skyblock-Dungeons-Guide-055520e1d8313a302f58babc6526d95bf22b471f.tar.gz Skyblock-Dungeons-Guide-055520e1d8313a302f58babc6526d95bf22b471f.tar.bz2 Skyblock-Dungeons-Guide-055520e1d8313a302f58babc6526d95bf22b471f.zip |
remove unnecessary things
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java index 1cfb156c..ee4d056c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java @@ -6,20 +6,10 @@ import java.util.regex.Pattern; public class TextUtils { private static final Pattern STRIP_COLOR_PATTERN = Pattern.compile("(?i)ยง[0-9A-FK-OR]"); - private static final Pattern NUMBERS_SLASHES = Pattern.compile("[^0-9 /]"); - private static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile("[^a-z A-Z:0-9/'.]"); - private static final Pattern FLOAT_CHARACTERS = Pattern.compile("[^.0-9\\-]"); - private static final Pattern INTEGER_CHARACTERS = Pattern.compile("[^0-9]"); - private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#,###.##"); - - public static String formatDouble(double number) { - return DECIMAL_FORMAT.format(number); - } - public static String stripColor(String input) { return STRIP_COLOR_PATTERN.matcher(input).replaceAll(""); } @@ -28,54 +18,8 @@ public class TextUtils { return SCOREBOARD_CHARACTERS.matcher(text).replaceAll(""); } - public static String keepFloatCharactersOnly(String text) { - return FLOAT_CHARACTERS.matcher(text).replaceAll(""); - } - public static String keepIntegerCharactersOnly(String text) { return INTEGER_CHARACTERS.matcher(text).replaceAll(""); } - public static String getNumbersOnly(String text) { - return NUMBERS_SLASHES.matcher(text).replaceAll(""); - } - - public static String removeDuplicateSpaces(String text) { - return text.replaceAll("\\s+", " "); - } - - public static String reverseText(String originalText) { - StringBuilder newString = new StringBuilder(); - String[] parts = originalText.split(" "); - for (int i = parts.length; i > 0; i--) { - String textPart = parts[i - 1]; - boolean foundCharacter = false; - for (char letter : textPart.toCharArray()) { - if (letter > ')') { - foundCharacter = true; - newString.append((new StringBuilder(textPart)).reverse().toString()); - break; - } - } - newString.append(" "); - if (!foundCharacter) - newString.insert(0, textPart); - newString.insert(0, " "); - } - return removeDuplicateSpaces(newString.toString().trim()); -} - - public static String getOrdinalSuffix(int n) { - if (n >= 11 && n <= 13) - return "th"; - switch (n % 10) { - case 1: - return "st"; - case 2: - return "nd"; - case 3: - return "rd"; - } - return "th"; - } }
\ No newline at end of file |