Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.application.timewarp.utilities
Class StringUtils  view StringUtils download StringUtils.java

java.lang.Object
  extended byorg.scopemvc.application.timewarp.utilities.StringUtils

public class StringUtils
extends java.lang.Object

A rich set of methods that can be used to manipulate strings. Adapted from http://wwwipd.ira.uka.de/~schmidt/alexandria/doc/alexandria/util/StringUtils.html .

Version:
1.0

Field Summary
private static byte[] bytes
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.String decodeJavaEscapes(java.lang.String s)
          Decodes a string that uses the java escapes.
static java.lang.String encodeWithJavaEscapes(java.lang.String s)
          Encodes a Unicode string in Java style, i.e.
static java.lang.String escapeCharsForJavascript(java.lang.String rtfFormatString)
          Processes the rtf formatted content string to replace backslashes and apostrophes so that javascript can handle the string.
static byte[] getEncodingFromTransliterationTable(char[] t)
          Returns the encoding for a transliteration table.
static java.lang.String getLastToken(java.lang.String t, java.lang.String delimiter)
          Strips the first part of the string up to the last occurence of delimiter.
static java.util.Locale getLocale(java.lang.String l)
          Returns the corresponding locale to a string ( "_" ( "_" )? )?
static java.lang.String getStackTrace(java.lang.Throwable t)
          Gets the stack trace
static char[] getTransliterationTableFromEncoding(java.lang.String enc)
          Returns a transliteration table to be used with wrapper objects for a java encoding.
static java.lang.String removeRTFFormatting(java.lang.String rtfString)
          TODO: document the method
static java.lang.String replace(java.lang.String s, java.lang.String repl, java.lang.String with)
          Replaces the given string repl by with in string s.
static java.lang.String replaceAll(java.lang.String s, char[] repl, char[] with)
          TODO: document the method
static java.lang.String replaceAll(java.lang.String s, java.lang.String[] repl, java.lang.String[] with)
          TODO: document the method
static java.lang.String[] split(java.lang.String text, java.lang.String delim)
          Splits a given text into an two-element array of string.
static java.lang.String[] splitAll_(java.lang.String text, java.lang.String delimiterString)
          Returns the array of all tokens that resulted from splitting the text at the occurences of delimiterString
static java.lang.String[] splitAll(java.lang.String text, java.lang.String delim)
          Returns an array of all tokens that resulted from splitting the text at the occurences of any of the characters in delim
static java.lang.String[] splitURL(java.lang.String url)
          Splits the url into the file and the query string.
static java.lang.String stripLastToken(java.lang.String t, java.lang.String delim)
          Returns the first part of the string up to the last occurence of the delimiter.
static java.lang.String stripQuotes(java.lang.String t)
          Checks if the given string is enclosed in double quotes and strips them if necessary.
static java.lang.String toString(java.util.Collection c, java.lang.String sep)
          Returns a string representation of the components of a vector.
static java.lang.String toString(java.lang.Object[] array, java.lang.String sep)
          Returns a string representation of an array.
static java.lang.String urlDecode(java.lang.String s)
          TODO: document the method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytes

private static byte[] bytes
Constructor Detail

StringUtils

public StringUtils()
Method Detail

getLastToken

public static java.lang.String getLastToken(java.lang.String t,
                                            java.lang.String delimiter)
Strips the first part of the string up to the last occurence of delimiter. If the delimiter is not contained in the string, the whole string is returned.


getTransliterationTableFromEncoding

public static char[] getTransliterationTableFromEncoding(java.lang.String enc)
                                                  throws java.io.UnsupportedEncodingException
Returns a transliteration table to be used with wrapper objects for a java encoding.


getEncodingFromTransliterationTable

public static byte[] getEncodingFromTransliterationTable(char[] t)
Returns the encoding for a transliteration table. All characters that cannot be encoded, will be encoded with byte 0.


getLocale

public static java.util.Locale getLocale(java.lang.String l)
Returns the corresponding locale to a string ( "_" ( "_" )? )?


getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable t)
Gets the stack trace


stripLastToken

public static java.lang.String stripLastToken(java.lang.String t,
                                              java.lang.String delim)
Returns the first part of the string up to the last occurence of the delimiter.


split

public static java.lang.String[] split(java.lang.String text,
                                       java.lang.String delim)
Splits a given text into an two-element array of string. The delimiter specifies where to split. Delimiters are not part of the result.


splitAll

public static java.lang.String[] splitAll(java.lang.String text,
                                          java.lang.String delim)
Returns an array of all tokens that resulted from splitting the text at the occurences of any of the characters in delim


splitAll_

public static java.lang.String[] splitAll_(java.lang.String text,
                                           java.lang.String delimiterString)
Returns the array of all tokens that resulted from splitting the text at the occurences of delimiterString


stripQuotes

public static java.lang.String stripQuotes(java.lang.String t)
Checks if the given string is enclosed in double quotes and strips them if necessary.


replace

public static java.lang.String replace(java.lang.String s,
                                       java.lang.String repl,
                                       java.lang.String with)
Replaces the given string repl by with in string s.


replaceAll

public static java.lang.String replaceAll(java.lang.String s,
                                          java.lang.String[] repl,
                                          java.lang.String[] with)
TODO: document the method


replaceAll

public static java.lang.String replaceAll(java.lang.String s,
                                          char[] repl,
                                          char[] with)
TODO: document the method


toString

public static java.lang.String toString(java.lang.Object[] array,
                                        java.lang.String sep)
Returns a string representation of an array. Components are separated by the specified separation string.


toString

public static java.lang.String toString(java.util.Collection c,
                                        java.lang.String sep)
Returns a string representation of the components of a vector. The components are separated by the specified separator.


encodeWithJavaEscapes

public static java.lang.String encodeWithJavaEscapes(java.lang.String s)
Encodes a Unicode string in Java style, i.e. the special characters for carriage return, new line, tab and form feed are escaped, ASCII chars outside 32 and 127 (inclusive) are escaped using Unicode escape notation.
The code was adapted from java.util.Properties


decodeJavaEscapes

public static java.lang.String decodeJavaEscapes(java.lang.String s)
                                          throws java.lang.IllegalArgumentException
Decodes a string that uses the java escapes.
Code adapted from java.util.Properties


splitURL

public static java.lang.String[] splitURL(java.lang.String url)
Splits the url into the file and the query string.


urlDecode

public static java.lang.String urlDecode(java.lang.String s)
TODO: document the method


removeRTFFormatting

public static java.lang.String removeRTFFormatting(java.lang.String rtfString)
TODO: document the method


escapeCharsForJavascript

public static java.lang.String escapeCharsForJavascript(java.lang.String rtfFormatString)
Processes the rtf formatted content string to replace backslashes and apostrophes so that javascript can handle the string.