-
Notifications
You must be signed in to change notification settings - Fork 4
MiscUtils
Aram edited this page May 4, 2025
·
3 revisions
The MiscUtils class provides utility methods for various common operations. This utility class includes methods for validating email addresses, converting strings to integers with default values, calculating Levenshtein distance, and converting hexadecimal color codes to RGB values.
-
isValidEmail(String)
Checks if a string is a valid email address.boolean isValid = MiscUtils.isValidEmail("example@example.com");
-
stringToIntWithDefault(String, int)
Converts a string to an integer, returning a default value if the string is not a valid integer.int result = MiscUtils.stringToIntWithDefault("123", 0);
-
calculateLevenshteinDistance(String, String)
Calculates the Levenshtein distance between two strings.int distance = MiscUtils.calculateLevenshteinDistance("kitten", "sitting");
-
hexToRGB(String)
Converts a hexadecimal color code to an RGB array.int[] rgb = MiscUtils.hexToRGB("#FFFFFF");
- Error Handling: If an input is invalid (e.g., an invalid hex color code), the method throws an appropriate exception and logs an error message.
- Utility Design: This class cannot be instantiated, as it contains a private constructor and only static methods.
Variant Loader
Data Pipeline
Network & Packets
Logging
Markdown
Utility Classes
- Conversion
- Math
- Minecraft
- Schedular