org.rubato.util
Class TextUtils

java.lang.Object
  extended by org.rubato.util.TextUtils

public final class TextUtils
extends java.lang.Object

Static utility functions for text handling.

Author:
Gérard Milmeister

Constructor Summary
TextUtils()
           
 
Method Summary
static java.lang.String escape(java.lang.String string)
          Escapes all characters as needed in the given string.
static java.lang.String parenthesize(java.lang.String s)
          Adds parenthesizes to the string.
static java.lang.String quote(java.lang.String string)
          Surrounds the given string with double quotes (").
static java.lang.String replaceStrings(java.lang.String string, java.lang.Object... objects)
          Returns a string generated from a pattern string, where for all n, all occurrences of %n and %nn are replaced by n-th argument in the objects list.
static java.lang.String[] split(java.lang.String string, char c)
          Splits the given string into its parts that are separated by the character c.
static java.lang.String unescape(java.lang.String string)
          Unescapes all escaped characters in the given string.
static java.lang.String unparenthesize(java.lang.String s)
          Strips any paired parentheses from around the string.
static java.lang.String unquote(java.lang.String string)
          Removes the double quotes at the beginning and the end of the given string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextUtils

public TextUtils()
Method Detail

replaceStrings

public static java.lang.String replaceStrings(java.lang.String string,
                                              java.lang.Object... objects)
Returns a string generated from a pattern string, where for all n, all occurrences of %n and %nn are replaced by n-th argument in the objects list. %n is replaced by the the string representation of the object, %%n is equivalent to \"%n\".


escape

public static java.lang.String escape(java.lang.String string)
Escapes all characters as needed in the given string.


unescape

public static java.lang.String unescape(java.lang.String string)
Unescapes all escaped characters in the given string.


quote

public static java.lang.String quote(java.lang.String string)
Surrounds the given string with double quotes (").


unquote

public static java.lang.String unquote(java.lang.String string)
Removes the double quotes at the beginning and the end of the given string.


split

public static java.lang.String[] split(java.lang.String string,
                                       char c)
Splits the given string into its parts that are separated by the character c.


parenthesize

public static java.lang.String parenthesize(java.lang.String s)
Adds parenthesizes to the string.


unparenthesize

public static java.lang.String unparenthesize(java.lang.String s)
Strips any paired parentheses from around the string. This only works for correctly balanced expressions.