Class StringUtils

java.lang.Object
net.ontopia.utils.StringUtils

public class StringUtils extends Object
INTERNAL: Class that contains useful string operation methods.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    INTERNAL: A string used internally for various control flow purposes.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    INTERNAL: Filters the specified string for characters that are senstive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.
    static void
    INTERNAL: Filters the specified string for characters that are senstive to HTML interpreters, writing the string with these characters replaced by the corresponding character entities to the given writer.
    static String
    makeRandomId(int length)
    INTERNAL: Make a random ID-like string of the given number of characters.
    static String
    INTERNAL: Creates a candidate ID from an input string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • VERY_UNLIKELY_STRING

      public static final String VERY_UNLIKELY_STRING
      INTERNAL: A string used internally for various control flow purposes. It is a string that is extremely unlikely to occur in real-world data.
      See Also:
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • escapeHTMLEntities

      public static String escapeHTMLEntities(String value)
      INTERNAL: Filters the specified string for characters that are senstive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.
      Parameters:
      value - The string to be filtered and returned
      Since:
      1.3.1
    • escapeHTMLEntities

      public static void escapeHTMLEntities(String value, Writer out) throws IOException
      INTERNAL: Filters the specified string for characters that are senstive to HTML interpreters, writing the string with these characters replaced by the corresponding character entities to the given writer.
      Parameters:
      value - The string to be filtered and written.
      Throws:
      IOException
      Since:
      3.0
    • makeRandomId

      public static String makeRandomId(int length)
      INTERNAL: Make a random ID-like string of the given number of characters.
    • normalizeId

      public static String normalizeId(String name)
      INTERNAL: Creates a candidate ID from an input string. The algorithm discards characters above U+00FF, strips accents off remaining characters, then discards everything that doesn't match the LTM NAME production (except leading characters, which turn into underscores). Whitespace is normalized, and turns into a hyphen when internal to the string. Letters are lowercased.