Package net.eternalclient.api.utilities
Class StringUtility
- java.lang.Object
-
- net.eternalclient.api.utilities.StringUtility
-
public class StringUtility extends java.lang.ObjectUtility class for manipulating strings and generating random strings.Note: This javadoc comment does not include explanations for each method, as requested.
-
-
Constructor Summary
Constructors Constructor Description StringUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringaddCharacter(char character, java.lang.String string, int amount)Adds a specified character to the beginning of a given string a specified number of times.static java.lang.Stringcapitalize(java.lang.String string)Capitalizes the given string.static java.lang.Stringclean(java.lang.String str)Replaces all occurrences of non-breaking spaces in a string with normal spaces.static java.lang.StringcleanColorText(java.lang.String text)Removes any HTML tags from the given text.static java.lang.Stringformat(java.lang.String str)Replaces all occurrences of space in the given string with a non-breaking space.static java.lang.StringgenerateRandomLetterString(int size)Generates a random string of lowercase letters.static booleanisNameClean(java.lang.String name)Checks if the given name is clean by checking if it is not null, not empty, not blank, and does not contain "null".
-
-
-
Method Detail
-
isNameClean
public static boolean isNameClean(java.lang.String name)
Checks if the given name is clean by checking if it is not null, not empty, not blank, and does not contain "null".- Parameters:
name- the name to be checked- Returns:
- true if the name is clean, false otherwise
-
clean
public static java.lang.String clean(java.lang.String str)
Replaces all occurrences of non-breaking spaces in a string with normal spaces.- Parameters:
str- the string to be cleaned- Returns:
- the string with non-breaking spaces replaced by normal spaces
-
format
public static java.lang.String format(java.lang.String str)
Replaces all occurrences of space in the given string with a non-breaking space.- Parameters:
str- the input string to be formatted- Returns:
- the formatted string with spaces replaced by non-breaking spaces
-
addCharacter
public static java.lang.String addCharacter(char character, java.lang.String string, int amount)Adds a specified character to the beginning of a given string a specified number of times.- Parameters:
character- the character to addstring- the original stringamount- the number of times to add the character- Returns:
- the modified string with the added characters
-
cleanColorText
public static java.lang.String cleanColorText(java.lang.String text)
Removes any HTML tags from the given text.- Parameters:
text- the text to be cleaned- Returns:
- the text with HTML tags removed
-
capitalize
public static java.lang.String capitalize(java.lang.String string)
Capitalizes the given string.- Parameters:
string- the string to be capitalized- Returns:
- the capitalized string
-
generateRandomLetterString
public static java.lang.String generateRandomLetterString(int size)
Generates a random string of lowercase letters.- Parameters:
size- the desired length of the string- Returns:
- the randomly generated string
-
-