/** * Escapes all the occurrences of the <toEscape> characters from the <string> if they are not escaped already * * @param string the string from which to escape the characters * @param toEscape the characters to escape as Array * @return a new string with the escaped <toEscape> characters */ @NotNull public static String escapeChars(@NotNull final String string, final char[] toEscape) { String toReturn = string; for (char character : toEscape) { toReturn = escapeChar(toReturn, character); } return toReturn; }
/** * Unscape all the occurrences of the <toUnescape> characters from the <string> * * @param string the string from which to unescape the characters * @param toUnescape the characters to unescape as Array * @return a new string with the unescaped <toUnescape> characters */ @NotNull public static String unescapeChars(@NotNull final String string, final char[] toUnescape) { String toReturn = string; for (char character : toUnescape) { toReturn = unescapeChar(toReturn, character); } return toReturn; }
/** * Removes all the occurrences of the \<toRemove> characters from the <string> * * @param string the string from which to remove the characters * @param toRemove the \character to remove from the <string> * @return a new string with the removed \<toRemove> characters */ @NotNull public static String removeEscapedChars(@NotNull final String string, final char[] toRemove) { String toReturn = string; for (char character : toRemove) { toReturn = removeEscapedChar(toReturn, character); } return toReturn; } }
/** * Removes all the occurrences of the \<toRemove> characters from the <string> * * @param string the string from which to remove the characters * @param toRemove the \character to remove from the <string> * @return a new string with the removed \<toRemove> characters */ @NotNull public static String removeEscapedChars(@NotNull final String string, final char[] toRemove) { String toReturn = string; for (char character : toRemove) { toReturn = removeEscapedChar(toReturn, character); } return toReturn; } }
/** * Unscape all the occurrences of the <toUnescape> characters from the <string> * * @param string the string from which to unescape the characters * @param toUnescape the characters to unescape as Array * @return a new string with the unescaped <toUnescape> characters */ @NotNull public static String unescapeChars(@NotNull final String string, final char[] toUnescape) { String toReturn = string; for (char character : toUnescape) { toReturn = unescapeChar(toReturn, character); } return toReturn; }
/** * Escapes all the occurrences of the <toEscape> characters from the <string> if they are not escaped already * * @param string the string from which to escape the characters * @param toEscape the characters to escape as Array * @return a new string with the escaped <toEscape> characters */ @NotNull public static String escapeChars(@NotNull final String string, final char[] toEscape) { String toReturn = string; for (char character : toEscape) { toReturn = escapeChar(toReturn, character); } return toReturn; }