Package webwork.util

Class TextUtil

java.lang.Object
webwork.util.TextUtil

public class TextUtil extends Object
This class handles HTML escaping of text. It was written and optimized to be as fast as possible.
Version:
$Revision: 1.9 $
Author:
Dick Zetterberg (dick@transitor.se)
  • Field Details

    • MAX_LENGTH

      protected static final int MAX_LENGTH
      See Also:
    • _stringChars

      protected static final char[][] _stringChars
      We use arrays of char in the lookup table because it is faster appending this to a StringBuffer than appending a String
  • Constructor Details

    • TextUtil

      public TextUtil()
  • Method Details

    • initMapping

      protected static void initMapping()
    • addMapping

      protected static void addMapping(int c, String txt, String[] strings)
    • escapeHTML

      public static final String escapeHTML(String s)
      Call escapeHTML(s, false)
    • escapeHTML

      public static final String escapeHTML(String s, boolean escapeEmpty)
      Escape HTML.
      Parameters:
      s - string to be escaped
      escapeEmpty - if true, then empty string will be escaped.