Package com.helger.base.string
Class StringRemove
java.lang.Object
com.helger.base.string.StringRemove
Helper class for removing characters or substrings from strings.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable StringRemove all occurrences of the passed character from the specified input stringstatic @Nullable StringRemove all occurrences of the passed character from the specified input stringstatic @NonNull StringremoveMultiple(@Nullable String sInputString, char @NonNull [] aRemoveChars) Optimized remove method that removes a set of characters from an input string!
-
Method Details
-
removeAll
Remove all occurrences of the passed character from the specified input string- Parameters:
sInputString- The input string where the character should be removed. If this parameter isnullor empty, no removing is done.cRemoveChar- The character to be removed.- Returns:
- The input string as is, if the input string is empty or if the remove char is not contained.
-
removeAll
public static @Nullable String removeAll(@Nullable String sInputString, @Nullable String sRemoveString) Remove all occurrences of the passed character from the specified input string- Parameters:
sInputString- The input string where the character should be removed. If this parameter isnullor empty, no removing is done.sRemoveString- The String to be removed. May benullor empty in which case nothing happens.- Returns:
- The input string as is, if the input string is empty or if the remove string is empty or not contained.
-
removeMultiple
public static @NonNull String removeMultiple(@Nullable String sInputString, char @NonNull [] aRemoveChars) Optimized remove method that removes a set of characters from an input string!- Parameters:
sInputString- The input string.aRemoveChars- The characters to remove. May not benull.- Returns:
- The version of the string without the passed characters or an empty String if the input
string was
null.
-