java.lang.Object
io.github.palexdev.materialfx.utils.StringUtils
public class StringUtils extends Object
Utils class for
Strings.-
Field Summary
Fields Modifier and Type Field Description static StringEMPTYstatic intINDEX_NOT_FOUND -
Constructor Summary
Constructors Constructor Description StringUtils() -
Method Summary
Modifier and Type Method Description static booleancontainsAll(String str, String split, String... words)Checks if the given string contains all the specifies words.static booleancontainsAny(String str, String split, String... words)Checks if the given string contains at least one of the given words.static booleancontainsIgnoreCase(CharSequence str, CharSequence searchStr)Checks if a CharSequence contains a search CharSequence irrespective of case, handlingnull.static Stringdifference(String str1, String str2)Finds the difference between twoStrings.static booleanendsWithIgnoreCase(String str, String suffix)Checks if the given string ends with the given prefix, ignores case.static intindexOfDifference(CharSequence cs1, CharSequence cs2)Finds the index at which twoCharSequencesdiffer.static StringreplaceIndex(String string, int startIndex, int endIndex, String replacement)static StringreplaceLast(String string, String substring, String replacement)Replaces the last occurrence of the given string with a new string.static booleanstartsWithIgnoreCase(String str, String prefix)Checks if thee given string starts with the specifies prefix, ignores case.static StringtitleCaseWord(String str)
-
Field Details
-
EMPTY
- See Also:
- Constant Field Values
-
INDEX_NOT_FOUND
public static final int INDEX_NOT_FOUND- See Also:
- Constant Field Values
-
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
difference
Finds the difference between twoStrings.- Parameters:
str1- The first Stringstr2- The second String- Returns:
- the difference between the two given strings
-
indexOfDifference
Finds the index at which twoCharSequencesdiffer.- Parameters:
cs1- The first sequencecs2- The second sequence
-
replaceLast
Replaces the last occurrence of the given string with a new string.- Parameters:
string- The string to modifysubstring- The last occurrence to findreplacement- The replacement- Returns:
- The modified string
-
replaceIndex
-
titleCaseWord
-
containsIgnoreCase
Checks if a CharSequence contains a search CharSequence irrespective of case, handling
null. Case-insensitivity is defined as byString.equalsIgnoreCase(String).A
nullCharSequence will returnfalse. -
startsWithIgnoreCase
Checks if thee given string starts with the specifies prefix, ignores case. -
endsWithIgnoreCase
Checks if the given string ends with the given prefix, ignores case. -
containsAny
Checks if the given string contains at least one of the given words.- Parameters:
split- this is the character that will split the input string, seeString.split(String)
-
containsAll
Checks if the given string contains all the specifies words.- Parameters:
split- this is the character that will split the input string, seeString.split(String)
-