Package net.sf.jasperreports.engine.util
Class JRStringUtil
- java.lang.Object
-
- net.sf.jasperreports.engine.util.JRStringUtil
-
public final class JRStringUtil extends Object
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_NUMBER_OUTSIDE_BOUNDSprotected static char[]HEX_DIGITSprotected static String[]HUNDRED_DIGITSprotected static StringJAVA_IDENTIFIER_PREFIXprotected static PatternPATTERN_CSS_INVALID_CHARACTERprotected static String[]TEN_DIGITSprotected static String[]THOUSAND_DIGITSprotected static String[]UNIT_DIGITS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static StringcssClassReplacement(String text)static StringencodeXmlAttribute(String text)static StringencodeXmlAttribute(String text, boolean exceptApos)static StringescapeJavaScript(String input)Escapes a text so that it can be used as a Java String literal.static StringescapeJavaStringLiteral(String text)Escapes a text so that it can be used as a Java String literal.static StringescapeString4JavaScript(String input)Escapes a Java String so that it can be used as a JavaScript String literal.static StringgetCSSClass(String name)static StringgetJavaIdentifier(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 StringgetLetterNumeral(int number, boolean isUpperCase)static StringgetRomanNumeral(int number, boolean isUpperCase)static StringgetString(Object value)static List<Integer>getTabIndexes(String text)static StringhtmlEncode(String text)static StringreplaceCRwithLF(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 StringxmlEncode(String text)static StringxmlEncode(String text, String invalidCharReplacement)
-
-
-
Field Detail
-
JAVA_IDENTIFIER_PREFIX
protected static final String JAVA_IDENTIFIER_PREFIX
- See Also:
- Constant Field Values
-
PATTERN_CSS_INVALID_CHARACTER
protected static final Pattern PATTERN_CSS_INVALID_CHARACTER
-
HEX_DIGITS
protected static final char[] HEX_DIGITS
-
EXCEPTION_MESSAGE_KEY_NUMBER_OUTSIDE_BOUNDS
public static final String EXCEPTION_MESSAGE_KEY_NUMBER_OUTSIDE_BOUNDS
- See Also:
- Constant Field Values
-
THOUSAND_DIGITS
protected static final String[] THOUSAND_DIGITS
-
HUNDRED_DIGITS
protected static final String[] HUNDRED_DIGITS
-
TEN_DIGITS
protected static final String[] TEN_DIGITS
-
UNIT_DIGITS
protected static final String[] UNIT_DIGITS
-
-
Method Detail
-
replaceCRwithLF
public 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.
-
getJavaIdentifier
public 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- Parameters:
name-
-
escapeJavaStringLiteral
public static String escapeJavaStringLiteral(String text)
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
public static String escapeJavaScript(String input)
Escapes a text so that it can be used as a Java String literal.- Parameters:
input-
-
escapeString4JavaScript
public static String escapeString4JavaScript(String input)
Escapes a Java String so that it can be used as a JavaScript String literal.- Parameters:
input-
-
getLetterNumeral
public static String getLetterNumeral(int number, boolean isUpperCase)
-
getRomanNumeral
public static String getRomanNumeral(int number, boolean isUpperCase)
- 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
-
-