com.borland.primetime.util
Class Strings

java.lang.Object
  |
  +--com.borland.primetime.util.Strings

public class Strings
extends java.lang.Object

Static methods for manipulating String instances including encoding/decoding.


Inner Class Summary
static class Strings.StringEncoding
          A StringEncoding instance provides an efficient way to encode a String by replacing characters that should be avoided in the encoded version with an alternate representation.
 
Field Summary
static Strings.StringEncoding STANDARD_ENCODING
          Static instance of StringEncoding which uses STANDARD_ENCODING_DESCRIPTION for its translation pairs.
static java.lang.String STANDARD_ENCODING_DESCRIPTION
          String that includes translation pairs used to encode/decode.
 
Constructor Summary
Strings()
           
 
Method Summary
static java.lang.String decode(java.lang.String encoded)
          Decode a String by restoring the original characters from their alternate representation as implemented by encode().
static java.lang.String[] decodeArray(java.lang.String encoded)
          Decodes a semicolon delimited list of strings encoded by encodeArray().
static java.lang.String encode(java.lang.String original)
          Encode a String by replacing characters that should be avoided in the encoded version with an alternate representation.
static java.lang.String encodeArray(java.lang.String[] original)
          Creates a semicolon delimited list of encoded strings using the standard encoding plus \: as an escape for a semicolon in any of the invidiual strings.
static java.lang.String format(java.lang.String string, java.lang.Object param1)
          Creates string from a template and substitution parameters.
static java.lang.String format(java.lang.String string, java.lang.Object[] params)
          Creates string from a template and substitution parameters.
static java.lang.String format(java.lang.String string, java.lang.Object param1, java.lang.Object param2)
          Creates string from a template and substitution parameters.
static java.lang.String format(java.lang.String string, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
          Creates string from a template and substitution parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STANDARD_ENCODING_DESCRIPTION

public static final java.lang.String STANDARD_ENCODING_DESCRIPTION
String that includes translation pairs used to encode/decode.

STANDARD_ENCODING

public static final Strings.StringEncoding STANDARD_ENCODING
Static instance of StringEncoding which uses STANDARD_ENCODING_DESCRIPTION for its translation pairs.
Constructor Detail

Strings

public Strings()
Method Detail

format

public static java.lang.String format(java.lang.String string,
                                      java.lang.Object[] params)
Creates string from a template and substitution parameters. This is a wrapper for java.text.MessageFormat().
Parameters:
string - String with substition markers, e.g. {0}
params - Substitution parameters, array order to match markers of 'string'.
Returns:
Formatted string.

format

public static java.lang.String format(java.lang.String string,
                                      java.lang.Object param1)
Creates string from a template and substitution parameters. This is a wrapper for java.text.MessageFormat().
Parameters:
string - String with substition markers, e.g. {0}
param1 - Substitution parameter for {0}
Returns:
Formatted string.

format

public static java.lang.String format(java.lang.String string,
                                      java.lang.Object param1,
                                      java.lang.Object param2)
Creates string from a template and substitution parameters. This is a wrapper for java.text.MessageFormat().
Parameters:
string - String with substition markers, e.g. {0}
param1 - Substitution parameter for {0}
param2 - Substitution parameter for {1}
Returns:
Formatted string.

format

public static java.lang.String format(java.lang.String string,
                                      java.lang.Object param1,
                                      java.lang.Object param2,
                                      java.lang.Object param3)
Creates string from a template and substitution parameters. This is a wrapper for java.text.MessageFormat().
Parameters:
string - String with substition markers, e.g. {0}
param1 - Substitution parameter for {0}
param2 - Substitution parameter for {1}
param3 - Substitution parameter for {2}
Returns:
Formatted string.

encodeArray

public static java.lang.String encodeArray(java.lang.String[] original)
Creates a semicolon delimited list of encoded strings using the standard encoding plus \: as an escape for a semicolon in any of the invidiual strings.
Parameters:
original - An array of String instances, none of which may be null.
Returns:
A semi-colon delimited String including an encoded version of each of the strings in the array. Null String is returned if the original array reference is null.

decodeArray

public static java.lang.String[] decodeArray(java.lang.String encoded)
Decodes a semicolon delimited list of strings encoded by encodeArray().
Returns:
An array of String instances, or null if the encoded string passed in is null.

encode

public static java.lang.String encode(java.lang.String original)
Encode a String by replacing characters that should be avoided in the encoded version with an alternate representation.
Parameters:
original - String to encode.
Returns:
Encoded version of 'original'.

decode

public static java.lang.String decode(java.lang.String encoded)
Decode a String by restoring the original characters from their alternate representation as implemented by encode().
Parameters:
encoded - String to decode.
Returns:
Original version of the String.