Package org.omegat.util
Class HTMLUtils
- java.lang.Object
-
- org.omegat.util.HTMLUtils
-
public final class HTMLUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
charsToEntities(java.lang.String str, java.lang.String encoding, java.util.Collection<java.lang.String> shortcuts)
Converts characters that must be converted (< > & ' ' (nbsp)) into HTML entities.static java.lang.String
entitiesToChars(java.lang.String str)
Converts HTML entities to normal charactersstatic java.lang.String
getSpacePostfix(java.lang.String input, boolean compressWhitespace)
static java.lang.String
getSpacePrefix(java.lang.String input, boolean compressWhitespace)
static boolean
isDecimalDigit(int ch)
Returns true if a char is a decimal digitstatic boolean
isHexDigit(int ch)
Returns true if a char is a hex digitstatic boolean
isLatinLetter(int ch)
Returns true if a char is a latin letter
-
-
-
Method Detail
-
entitiesToChars
public static java.lang.String entitiesToChars(java.lang.String str)
Converts HTML entities to normal characters
-
isLatinLetter
public static boolean isLatinLetter(int ch)
Returns true if a char is a latin letter
-
isDecimalDigit
public static boolean isDecimalDigit(int ch)
Returns true if a char is a decimal digit
-
isHexDigit
public static boolean isHexDigit(int ch)
Returns true if a char is a hex digit
-
charsToEntities
public static java.lang.String charsToEntities(java.lang.String str, java.lang.String encoding, java.util.Collection<java.lang.String> shortcuts)
Converts characters that must be converted (< > & ' ' (nbsp)) into HTML entities.- Parameters:
str
- The string to convertencoding
- The output encoding. May be null (all characters are assumed to be supported).shortcuts
- A collection of tag-like strings (<foo>
) that will be "protected", i.e. they will not be escaped as entities.
-
getSpacePrefix
public static java.lang.String getSpacePrefix(java.lang.String input, boolean compressWhitespace)
-
getSpacePostfix
public static java.lang.String getSpacePostfix(java.lang.String input, boolean compressWhitespace)
-
-