Class StringUtil

java.lang.Object
net.targetr.wtm3.util.StringUtil

public class StringUtil extends Object
String utility methods.
  • Method Details

    • format

      public static String format(String template, Map<String,String> params)
      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

      public static String formatStackTrace(Throwable ex)
      Converts an exception to a plain text stack trace.
      Parameters:
      ex - Exception to convert.
      Returns:
      Text version of stack trace.
    • escapeHtml

      public static String escapeHtml(String input)
      Escapes HTML characters in a string to prevent XSS.
      Parameters:
      input - the string to escape
      Returns:
      the escaped string