anecho.gui
Class TextUtils

java.lang.Object
  extended by anecho.gui.TextUtils

public final class TextUtils
extends java.lang.Object

This class contains methods to do some common string requirements such as stripping escape characters.


Method Summary
static java.lang.String cleanURL(java.lang.String input)
          This method is used to remove extra characters from a URL.
static int countSplits(java.lang.String inStr, java.lang.String splitStr)
          Counts the number of times the matching string appears in the given string An instance of the split as the first substring does not count as a match, as a real "split" cannot occur if there is nothing infront of it.
static java.lang.String[] splitter(java.lang.String inStr, java.lang.String splitStr)
          This method splits the given string into an array of strings separated
static double stringToDouble(java.lang.String input)
          This method converts the numeric portion of a String to an Int.
static java.lang.String stripEscapes(java.lang.String token, boolean useBell)
          This method returns the value of a string once it has had any escape characters stripped from it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stripEscapes

public static java.lang.String stripEscapes(java.lang.String token,
                                            boolean useBell)
This method returns the value of a string once it has had any escape characters stripped from it.

Parameters:
token - The string that will be analysed for escape characters.
useBell - true - trigger system "bell" if a bell sequence is stripped. false - do not trigger the system "bell" if a bell sequence is stripped.
Returns:
Returns the initial string with escapes removed.

cleanURL

public static java.lang.String cleanURL(java.lang.String input)
This method is used to remove extra characters from a URL. Thoug not entirely scientific, it will get rid of things like trailing quotation marks

Parameters:
input -
Returns:

stringToDouble

public static double stringToDouble(java.lang.String input)
This method converts the numeric portion of a String to an Int. For example, having a Java version of 1.6.0_01 will return 1.6.0 (discarding everything after the first non-numeric character)

Parameters:
input - A mix string of numbers and characters
Returns:
An integer based on the intial string

splitter

public static java.lang.String[] splitter(java.lang.String inStr,
                                          java.lang.String splitStr)
This method splits the given string into an array of strings separated

Parameters:
inStr - The given string to split
splitStr - The string to base the splitting on
Returns:
An array of strings containing the split text

countSplits

public static int countSplits(java.lang.String inStr,
                              java.lang.String splitStr)
Counts the number of times the matching string appears in the given string An instance of the split as the first substring does not count as a match, as a real "split" cannot occur if there is nothing infront of it.

Parameters:
inStr - The main string to compare against
splitStr - The matching portions to find
Returns:
A count of the number of times splitStr appears within inStr