net.sf.jasperreports.engine.util

## Class JRStringUtil

- java.lang.Object
- - net.sf.jasperreports.engine.util.JRStringUtil

-     public final class JRStringUtil
      extends java.lang.Object

  Version:
    $Id: JRStringUtil.java 7083 2014-05-08 15:25:20Z lucianc $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `JAVA_IDENTIFIER_PREFIX`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `encodeXmlAttribute(java.lang.String text)`
    `static java.lang.String` | `escapeJavaScript(java.lang.String input)` Escapes a text so that it can be used as a Java String literal.
    `static java.lang.String` | `escapeJavaStringLiteral(java.lang.String text)` Escapes a text so that it can be used as a Java String literal.
    `static java.lang.String` | `escapeJSONString(java.lang.String text)` Escapes a text to be used for a JSON string value.
    `static java.lang.String` | `escapeString4JavaScript(java.lang.String input)` Escapes a Java String so that it can be used as a JavaScript String literal.
    `static java.lang.String` | `getJavaIdentifier(java.lang.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 java.lang.String` | `getString(java.lang.Object value)`
    `static java.util.List<java.lang.Integer>` | `getTabIndexes(java.lang.String text)`
    `static java.lang.String` | `htmlEncode(java.lang.String text)`
    `static java.lang.String` | `replaceCRwithLF(java.lang.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 java.util.List<java.lang.String>` | `split(java.lang.String[] srcArray, java.lang.String delimiterRegExp)`
    `static java.lang.String` | `xmlEncode(java.lang.String text)`
    `static java.lang.String` | `xmlEncode(java.lang.String text, java.lang.String invalidCharReplacement)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### JAVA_IDENTIFIER_PREFIX

          protected static final java.lang.String JAVA_IDENTIFIER_PREFIX

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### replaceCRwithLF

          public static java.lang.String replaceCRwithLF(java.lang.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.

    - #### xmlEncode

          public static java.lang.String xmlEncode(java.lang.String text)

    - #### xmlEncode

          public static java.lang.String xmlEncode(java.lang.String text,
                                   java.lang.String invalidCharReplacement)

    - #### encodeXmlAttribute

          public static java.lang.String encodeXmlAttribute(java.lang.String text)

    - #### htmlEncode

          public static java.lang.String htmlEncode(java.lang.String text)

    - #### getJavaIdentifier

          public static java.lang.String getJavaIdentifier(java.lang.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 java.lang.String escapeJavaStringLiteral(java.lang.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 java.lang.String escapeJavaScript(java.lang.String input)

      Escapes a text so that it can be used as a Java String literal.
      Parameters:
        `input` -

    - #### escapeString4JavaScript

          public static java.lang.String escapeString4JavaScript(java.lang.String input)

      Escapes a Java String so that it can be used as a JavaScript String literal.
      Parameters:
        `input` -

    - #### getTabIndexes

          public static java.util.List<java.lang.Integer> getTabIndexes(java.lang.String text)

    - #### split

          public static java.util.List<java.lang.String> split(java.lang.String[] srcArray,
                                               java.lang.String delimiterRegExp)

    - #### getString

          public static java.lang.String getString(java.lang.Object value)

    - #### escapeJSONString

          public static java.lang.String escapeJSONString(java.lang.String text)

      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

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com