com.cometway.email
Class EmailTools

java.lang.Object
  extended by com.cometway.email.EmailTools

public class EmailTools
extends java.lang.Object

Defines a set of static methods useful for parsing email information.


Constructor Summary
EmailTools()
           
 
Method Summary
static TextRange change(java.lang.String find, java.lang.String replace, TextRange t)
          Does a case-sensitive find and replace within the specified com.cometway.text.TextRange.
static TextRange change(java.lang.String find, java.lang.String replace, TextRange t, boolean ignoreCase)
          Does a find and replace within the specified com.cometway.text.TextRange.
static java.lang.String fixForHTML(java.lang.String text)
          Returns a String with greater-than (>), less-than (<), and carriage return (\n) characters changed for HTML compatibility (>, <, and
respectively).
static java.lang.String formatDouble(double value)
          Formats a double value to 2 decimal places as a String.
static java.lang.String formatDouble(double value, boolean fixed)
          Formats a double value to 2 decimal places as a String.
static java.lang.String formatDouble(double value, int places)
          Formats a double value to the specified number of decimal places.
static java.lang.String formatDouble(double value, int places, boolean fixed)
          Formats a double value to the specified number of decimal places as a String.
static java.lang.String formatWrap(java.lang.String s, int width)
          Word wraps the a String to the specified number of columns and returns the wrapped String.
static Pair parseEmailAddress(java.lang.String email)
          This method parses the specified String typically containing the text contents from an email message header (ie: "Bob Smith" ) and returns two String components as a Pair.
static java.lang.String stripEnds(java.lang.String s)
          Returns a String with surrounding symbols (ie: (), <>, "") removed from the specified String.
static java.lang.String stripSpecialChars(java.lang.String s)
          Removes any escaped ASCII characters that use the notation &#ascii_val; (ie: É) and returns the result as a String.
static TextRange textBetween(java.lang.String b, java.lang.String a, StringTextBuffer s)
          Returns a TextRange representing the text between before and after parameters within the specified com.cometway.text.StringTextBuffer.
static TextRange textBetween(java.lang.String b, java.lang.String a, TextRange t)
          Returns a TextRange representing the text between before and after parameters within the specified com.cometway.text.TextRange.
static TextRange textBetween(java.lang.String b, java.lang.String a, TextRange t, boolean ignoreCase)
          Returns a TextRange representing the text between before and after parameters within the specified com.cometway.text.TextRange.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmailTools

public EmailTools()
Method Detail

change

public static TextRange change(java.lang.String find,
                               java.lang.String replace,
                               TextRange t)
Does a case-sensitive find and replace within the specified com.cometway.text.TextRange. Returns a new TextRange representing the changed contents of the TextRange.


change

public static TextRange change(java.lang.String find,
                               java.lang.String replace,
                               TextRange t,
                               boolean ignoreCase)
Does a find and replace within the specified com.cometway.text.TextRange. Case-sensitivity can be specified. Returns a new TextRange representing the changed contents of the TextRange.


textBetween

public static TextRange textBetween(java.lang.String b,
                                    java.lang.String a,
                                    TextRange t)
Returns a TextRange representing the text between before and after parameters within the specified com.cometway.text.TextRange. Returns a new TextRange representing the isolated text.


textBetween

public static TextRange textBetween(java.lang.String b,
                                    java.lang.String a,
                                    StringTextBuffer s)
Returns a TextRange representing the text between before and after parameters within the specified com.cometway.text.StringTextBuffer. Returns a new TextRange representing the isolated text.


textBetween

public static TextRange textBetween(java.lang.String b,
                                    java.lang.String a,
                                    TextRange t,
                                    boolean ignoreCase)
Returns a TextRange representing the text between before and after parameters within the specified com.cometway.text.TextRange. Case-sensitivity can be specified. Returns a new TextRange representing the isolated text.


formatWrap

public static java.lang.String formatWrap(java.lang.String s,
                                          int width)
Word wraps the a String to the specified number of columns and returns the wrapped String.


stripSpecialChars

public static java.lang.String stripSpecialChars(java.lang.String s)
Removes any escaped ASCII characters that use the notation &#ascii_val; (ie: É) and returns the result as a String.


formatDouble

public static java.lang.String formatDouble(double value)
Formats a double value to 2 decimal places as a String. Ending zeros are ommitted.


formatDouble

public static java.lang.String formatDouble(double value,
                                            int places)
Formats a double value to the specified number of decimal places. Ending zeros are ommitted.


formatDouble

public static java.lang.String formatDouble(double value,
                                            boolean fixed)
Formats a double value to 2 decimal places as a String. Set the fixed parameter to true if ending zeros are required.


formatDouble

public static java.lang.String formatDouble(double value,
                                            int places,
                                            boolean fixed)
Formats a double value to the specified number of decimal places as a String. Set the fixed parameter to true if ending zeros are required.


parseEmailAddress

public static Pair parseEmailAddress(java.lang.String email)
This method parses the specified String typically containing the text contents from an email message header (ie: "Bob Smith" ) and returns two String components as a Pair. The first element of the Pair is the email name and the second element will contain the email address.


stripEnds

public static java.lang.String stripEnds(java.lang.String s)
Returns a String with surrounding symbols (ie: (), <>, "") removed from the specified String.


fixForHTML

public static java.lang.String fixForHTML(java.lang.String text)
Returns a String with greater-than (>), less-than (<), and carriage return (\n) characters changed for HTML compatibility (>, <, and
respectively).