public final class JRStringUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static char[] |
HEX_DIGITS |
protected static String |
JAVA_IDENTIFIER_PREFIX |
protected static Pattern |
PATTERN_CSS_INVALID_CHARACTER |
Modifier and Type | Method and Description |
---|---|
protected static String |
cssClassReplacement(String text) |
static String |
encodeXmlAttribute(String text) |
static String |
escapeJavaScript(String input)
Escapes a text so that it can be used as a Java String literal.
|
static String |
escapeJavaStringLiteral(String text)
Escapes a text so that it can be used as a Java String literal.
|
static String |
escapeJSONString(String text)
Escapes a text to be used for a JSON string value.
|
static String |
escapeString4JavaScript(String input)
Escapes a Java String so that it can be used as a JavaScript String literal.
|
static String |
getCSSClass(String name) |
static String |
getJavaIdentifier(String name)
Takes a name and returns the same if it is a Java identifier;
else it substitutes the illegal characters so that it can be an identifier
|
static String |
getString(Object value) |
static List<Integer> |
getTabIndexes(String text) |
static String |
htmlEncode(String text) |
static String |
replaceCRwithLF(String text)
This method replaces all occurrences of the CR character with the LF character,
except when the CR is immediately followed by a LF (CRLF sequences), in which case the CR is removed.
|
static List<String> |
split(String[] srcArray,
String delimiterRegExp) |
static String |
xmlEncode(String text) |
static String |
xmlEncode(String text,
String invalidCharReplacement) |
protected static final String JAVA_IDENTIFIER_PREFIX
protected static final Pattern PATTERN_CSS_INVALID_CHARACTER
protected static final char[] HEX_DIGITS
public static String replaceCRwithLF(String text)
public static String getJavaIdentifier(String name)
name
- public static String escapeJavaStringLiteral(String text)
text
- the textpublic static String escapeJavaScript(String input)
input
- public static String escapeString4JavaScript(String input)
input
- public static String escapeJSONString(String text)
text
- the text to escape for JSONCopyright © 2017. All rights reserved.