org.jscience.util
Class StringUtils

java.lang.Object
  extended by org.jscience.util.StringUtils

public final class StringUtils
extends java.lang.Object

A utility class with some useful functions to manipulate String objects.


Field Summary
static java.lang.String COPYRIGHT
          represents the symbol for use in HTML or XML
static java.lang.String EURO
          represents the Euro currency symbol
static java.text.SimpleDateFormat ietfDateFormat
          the IETF date format is used in HTTP headers for displaying the date.
static java.lang.String lb
          convenient access to the platform dependent line separator
static java.lang.String LEFT_DOUBLE_QUOTE
          represents the symbol for use in HTML or XML
static java.lang.String REGISTERED_TM
          represents the symbol for use in HTML or XML
static java.lang.String RIGHT_DOUBLE_QUOTE
          represents the symbol for use in HTML or XML
static java.lang.String TRADEMARK
          represents the symbol for use in HTML or XML
static java.lang.String XML_HEADER
          xml header line with utf8
 
Method Summary
static int count(java.lang.String text, java.lang.String pattern)
          counts how many times the given pattern occurs in the given text.
static int countIgnoreCase(java.lang.String text, java.lang.String pattern)
          counts how many times the given pattern occurs in the given text.
static java.lang.String decodeUTF(java.lang.String s)
          DOCUMENT ME!
static java.lang.String decodeXML(java.lang.String text)
          decodes an HTML or XML text sequence into human readable form using the translateArray
static java.lang.String encodeUTF(java.lang.String s)
          DOCUMENT ME!
static java.lang.String encodeXML(java.lang.String text)
          encodes a text string to use as text in an HTML or XML document using the translateArray
static int indexOfIgnoreCase(java.lang.String textToSearch, java.lang.String pattern)
          calls the method with the same name adding index 0
static int indexOfIgnoreCase(java.lang.String textToSearch, java.lang.String pattern, int fromIndex)
           
static java.lang.String mapAsString(java.util.Map map, java.lang.String fieldSeparator, java.lang.String lineSeparator)
          DOCUMENT ME!
static java.lang.String replaceAll(java.lang.String original, java.lang.String oldSubString, java.lang.String newSubString)
          replaces every occurrence of oldSubString with newSubString within the original String and returns the resulting string (no regular expressions are used)
static java.lang.String replaceAllIgnoreCase(java.lang.String original, java.lang.String oldSubString, java.lang.String newSubString)
          replaces every occurrence of oldSubString (ignoring case) with newSubString within the original String and returns the resulting string (no regular expressions are used)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ietfDateFormat

public static final java.text.SimpleDateFormat ietfDateFormat
the IETF date format is used in HTTP headers for displaying the date. Since Java deprecated java.util.Date.parse(String), this offers an easy way to make the IETF date format work in any non-deprecated API.


lb

public static final java.lang.String lb
convenient access to the platform dependent line separator


EURO

public static final java.lang.String EURO
represents the Euro currency symbol

See Also:
Constant Field Values

XML_HEADER

public static final java.lang.String XML_HEADER
xml header line with utf8

See Also:
Constant Field Values

LEFT_DOUBLE_QUOTE

public static final java.lang.String LEFT_DOUBLE_QUOTE
represents the symbol for use in HTML or XML

See Also:
Constant Field Values

RIGHT_DOUBLE_QUOTE

public static final java.lang.String RIGHT_DOUBLE_QUOTE
represents the symbol for use in HTML or XML

See Also:
Constant Field Values

TRADEMARK

public static final java.lang.String TRADEMARK
represents the symbol for use in HTML or XML

See Also:
Constant Field Values

REGISTERED_TM

public static final java.lang.String REGISTERED_TM
represents the symbol for use in HTML or XML

See Also:
Constant Field Values

COPYRIGHT

public static final java.lang.String COPYRIGHT
represents the symbol for use in HTML or XML

See Also:
Constant Field Values
Method Detail

replaceAll

public static java.lang.String replaceAll(java.lang.String original,
                                          java.lang.String oldSubString,
                                          java.lang.String newSubString)
replaces every occurrence of oldSubString with newSubString within the original String and returns the resulting string (no regular expressions are used)

Parameters:
original - DOCUMENT ME!
oldSubString - DOCUMENT ME!
newSubString - DOCUMENT ME!
Returns:
DOCUMENT ME!

replaceAllIgnoreCase

public static java.lang.String replaceAllIgnoreCase(java.lang.String original,
                                                    java.lang.String oldSubString,
                                                    java.lang.String newSubString)
replaces every occurrence of oldSubString (ignoring case) with newSubString within the original String and returns the resulting string (no regular expressions are used)

Parameters:
original - DOCUMENT ME!
oldSubString - DOCUMENT ME!
newSubString - DOCUMENT ME!
Returns:
DOCUMENT ME!

indexOfIgnoreCase

public static int indexOfIgnoreCase(java.lang.String textToSearch,
                                    java.lang.String pattern)
calls the method with the same name adding index 0

Parameters:
textToSearch - DOCUMENT ME!
pattern - DOCUMENT ME!
Returns:
DOCUMENT ME!

indexOfIgnoreCase

public static int indexOfIgnoreCase(java.lang.String textToSearch,
                                    java.lang.String pattern,
                                    int fromIndex)

count

public static int count(java.lang.String text,
                        java.lang.String pattern)
counts how many times the given pattern occurs in the given text. Example: count("ababababab", "abab") returns 2.

Parameters:
text - DOCUMENT ME!
pattern - DOCUMENT ME!
Returns:
DOCUMENT ME!

countIgnoreCase

public static int countIgnoreCase(java.lang.String text,
                                  java.lang.String pattern)
counts how many times the given pattern occurs in the given text. Example: count("ababababab", "abab") returns 2.

Parameters:
text - DOCUMENT ME!
pattern - DOCUMENT ME!
Returns:
DOCUMENT ME!

encodeXML

public static java.lang.String encodeXML(java.lang.String text)
encodes a text string to use as text in an HTML or XML document using the translateArray

Parameters:
text - DOCUMENT ME!
Returns:
DOCUMENT ME!

decodeXML

public static java.lang.String decodeXML(java.lang.String text)
decodes an HTML or XML text sequence into human readable form using the translateArray

Parameters:
text - DOCUMENT ME!
Returns:
DOCUMENT ME!

encodeUTF

public static java.lang.String encodeUTF(java.lang.String s)
DOCUMENT ME!

Parameters:
s - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.RuntimeException - DOCUMENT ME!

decodeUTF

public static java.lang.String decodeUTF(java.lang.String s)
DOCUMENT ME!

Parameters:
s - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.RuntimeException - DOCUMENT ME!

mapAsString

public static java.lang.String mapAsString(java.util.Map map,
                                           java.lang.String fieldSeparator,
                                           java.lang.String lineSeparator)
DOCUMENT ME!

Parameters:
map - DOCUMENT ME!
fieldSeparator - DOCUMENT ME!
lineSeparator - DOCUMENT ME!
Returns:
DOCUMENT ME!