Package net.targetr.wtm3.util
Class StringUtil
java.lang.Object
net.targetr.wtm3.util.StringUtil
String utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapeHtml(String input) Escapes HTML characters in a string to prevent XSS.static StringReplaces placeholders in a template string with corresponding values from a map.static StringConverts an exception to a plain text stack trace.
-
Method Details
-
format
Replaces placeholders in a template string with corresponding values from a map.- Parameters:
template- The template string containing placeholders in the format ${key}.params- A map of key-value pairs to replace placeholders with.- Returns:
- The formatted string with placeholders replaced by their corresponding values.
-
formatStackTrace
Converts an exception to a plain text stack trace.- Parameters:
ex- Exception to convert.- Returns:
- Text version of stack trace.
-
escapeHtml
Escapes HTML characters in a string to prevent XSS.- Parameters:
input- the string to escape- Returns:
- the escaped string
-