Package net.ontopia.utils
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 StringVERY_UNLIKELY_STRINGINTERNAL: A string used internally for various control flow purposes.
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringescapeHTMLEntities(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.static voidescapeHTMLEntities(String value, Writer out)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 StringmakeRandomId(int length)INTERNAL: Make a random ID-like string of the given number of characters.static StringnormalizeId(String name)INTERNAL: Creates a candidate ID from an input string.
-
-
-
Field Detail
-
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:
- Constant Field Values
-
-
Method Detail
-
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.
-
-