Package net.sf.jasperreports.engine.util
Class JRStringUtil
java.lang.Object
net.sf.jasperreports.engine.util.JRStringUtil
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected static String
cssClassReplacement
(String text) static String
encodeXmlAttribute
(String text) static String
encodeXmlAttribute
(String text, boolean exceptApos) static String
escapeJavaScript
(String input) Escapes a text so that it can be used as a Java String literal.static String
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 identifierstatic String
getLetterNumeral
(int number, boolean isUpperCase) static String
getRomanNumeral
(int number, boolean isUpperCase) static String
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 String
static String
-
Field Details
-
JAVA_IDENTIFIER_PREFIX
- See Also:
-
PATTERN_CSS_INVALID_CHARACTER
-
HEX_DIGITS
protected static final char[] HEX_DIGITS -
EXCEPTION_MESSAGE_KEY_NUMBER_OUTSIDE_BOUNDS
- See Also:
-
THOUSAND_DIGITS
-
HUNDRED_DIGITS
-
TEN_DIGITS
-
UNIT_DIGITS
-
-
Method Details
-
replaceCRwithLF
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. -
xmlEncode
-
xmlEncode
-
encodeXmlAttribute
-
encodeXmlAttribute
-
htmlEncode
-
getJavaIdentifier
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- Parameters:
name
-
-
escapeJavaStringLiteral
Escapes a text so that it can be used as a Java String literal.- Parameters:
text
- the text- Returns:
- the text with escaped quotes and backslashes
-
escapeJavaScript
Escapes a text so that it can be used as a Java String literal.- Parameters:
input
-
-
escapeString4JavaScript
Escapes a Java String so that it can be used as a JavaScript String literal.- Parameters:
input
-
-
getTabIndexes
-
split
-
getString
-
escapeJSONString
Escapes a text to be used for a JSON string value.- Parameters:
text
- the text to escape for JSON- Returns:
- the escaped text if not null
-
getCSSClass
-
cssClassReplacement
-
getLetterNumeral
-
getRomanNumeral
- Parameters:
number
- an integer value between 1 and 3999isUpperCase
- specifies whether the result should be made of upper case characters- Returns:
- the Roman numeral representation of this number
-