org.safs.StringUtilities
Class StringUtilities

java.lang.Object
  |
  +--org.safs.StringUtilities.StringUtilities

public abstract class StringUtilities
extends java.lang.Object


Constructor Summary
StringUtilities()
           
 
Method Summary
static boolean charIsInRange(char c, int beg, int end)
          Method charIsInRange.
static int getNumSubstrings(java.lang.String strSub, java.lang.String strText)
          Method getNumSubstrings.
static java.util.Vector getSubStrings(java.lang.String strText)
          Method getSubStrings.
static java.util.Vector getSubStrings(java.lang.String strText, java.util.Vector vQuoteLocs)
          Method getSubStrings.
static boolean isLegalVarName(java.lang.String strVarName)
          Method isLegalVarName.
static boolean isQuoted(java.lang.String strText, int location)
          Method isQuoted.
static boolean isQuoted(java.lang.String strText, int location, java.util.Vector vQuoteLocs)
          Method isQuoted.
static boolean isValidNonStdChar(char c)
          Method isValidNonStdChar.
static int locateNextUnquotedSingleChar(java.lang.String strSearch, java.lang.String strChars, int ipos)
          Method locateNextUnquotedSingleChar.
static int locateNextUnquotedSingleChar(java.lang.String strSearch, java.lang.String strChars, int ipos, java.util.Vector vQuoteLocs)
          Method locateNextUnquotedSingleChar.
static int locateNextUnquotedSubstring(java.lang.String strSearch, java.lang.String strFind, int ipos)
          Method locateNextUnquotedSubstring.
static int locateNextUnquotedSubstring(java.lang.String strSearch, java.lang.String strFind, int ipos, java.util.Vector vQuoteLocs)
          Method locateNextUnquotedSubstring.
static java.util.Vector locateQuotedSubStrings(java.lang.String strText)
          Method locateQuotedSubStrings.
static java.lang.String LTWhitespace(java.lang.String strValue)
          Method LTWhitespace.
static boolean nextCharIsDQ(java.lang.String strText, int location)
          Method nextCharIsDQ.
static java.lang.String removeAllNonQuotedWhitespace(java.lang.String strValue)
          Method removeAllNonQuotedWhitespace.
static java.lang.String removeAllNonQuotedWhitespace(java.lang.String strValue, java.util.Vector vQuoteLocs)
          Method removeAllNonQuotedWhitespace.
static java.lang.String replaceString(java.lang.String strSearch, java.lang.String strReplace, int ibegin, int iend)
          Method replaceString.
static java.lang.String reverse(java.lang.String s)
          Method reverse.
static java.lang.String RTWhitespace(java.lang.String strValue)
          Method RTWhitespace.
static java.lang.String TWhitespace(java.lang.String strValue)
          Method TWhitespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtilities

public StringUtilities()
Method Detail

LTWhitespace

public static java.lang.String LTWhitespace(java.lang.String strValue)
Method LTWhitespace. Remove whitespace (space and tab chars) from start of strings
Parameters:
strValue - String to remove leading whitespace (space and tab)
Returns:
strValue without leading whitespace

RTWhitespace

public static java.lang.String RTWhitespace(java.lang.String strValue)
Method RTWhitespace. Remove whitespace (space and tab chars) from end of strings
Parameters:
strValue - String to remove trailing whitespace (space and tab)
Returns:
strValue without trailing whitespace

TWhitespace

public static java.lang.String TWhitespace(java.lang.String strValue)
Method TWhitespace. Remove whitespace (space and tab chars) from start and end of strings
Parameters:
strValue - String to remove whitespace (space and tab)
Returns:
strValue without leading or trailing whitespace

charIsInRange

public static boolean charIsInRange(char c,
                                    int beg,
                                    int end)
Method charIsInRange. Return boolean T/F specifying wheather char is numerically between integers beg and end. ( c >= beg && c <= end )
Parameters:
c - character to check
beg - lower end of range
end - higher end of range
Returns:
boolean

getNumSubstrings

public static int getNumSubstrings(java.lang.String strSub,
                                   java.lang.String strText)
Method getNumSubstrings. Returns the number of occurances of strSub within strText as an integer
Parameters:
strSub - substring to count occurances
strText - string to search for strSub occurances
Returns:
int

nextCharIsDQ

public static boolean nextCharIsDQ(java.lang.String strText,
                                   int location)
Method nextCharIsDQ. Return boolean T/F specifying wheather or not the character in strText at location+1 is a double quote (")
Parameters:
strText - String to check
location - int location to start check
Returns:
boolean

locateQuotedSubStrings

public static java.util.Vector locateQuotedSubStrings(java.lang.String strText)
Method locateQuotedSubStrings. Return a Vector that contains Integer objects whose intValue specifies the location of a double quote (") in strText. Note that double quotes must be paired so there should be an even number of Integer objects withing the returned Vector.
Parameters:
strText - String in which to locate the quoted substrings
Returns:
Vector

isQuoted

public static boolean isQuoted(java.lang.String strText,
                               int location)
Method isQuoted. Return boolean T/F specifying wheather or not the string within strText at int location is quoted (within double quotes)
Parameters:
strText - String to check
location - Location to check
Returns:
boolean

isQuoted

public static boolean isQuoted(java.lang.String strText,
                               int location,
                               java.util.Vector vQuoteLocs)
Method isQuoted. Return boolean T/F specifying wheather or not the string within strText at int location is quoted (within double quotes)
Parameters:
strText - String to check
location - Location to check
vQuoteLocs - Vector containing Integer objects whose intValue specifies the location of a double quote (") in strText.
Returns:
boolean

getSubStrings

public static java.util.Vector getSubStrings(java.lang.String strText)
Method getSubStrings. Return a Vector containing String objects that are quoted substrings within strText
Parameters:
strText - The string to find substrings
Returns:
Vector

getSubStrings

public static java.util.Vector getSubStrings(java.lang.String strText,
                                             java.util.Vector vQuoteLocs)
Method getSubStrings. Return a Vector containing String objects that are quoted substrings within strText
Parameters:
strText - The string to find substrings
vQuoteLocs - Vector containing Integer objects whose intValue specifies the location of a double quote (") in strText.
Returns:
Vector

locateNextUnquotedSingleChar

public static int locateNextUnquotedSingleChar(java.lang.String strSearch,
                                               java.lang.String strChars,
                                               int ipos)
Method locateNextUnquotedSingleChar. Return the integer location within strSearch that is first occurance of any of the characters making up strChars
Parameters:
strSearch - The string to search
strChars - A string consisting of single characters to find the first occurance of
ipos - int position within strSearch to begin search
Returns:
int

locateNextUnquotedSingleChar

public static int locateNextUnquotedSingleChar(java.lang.String strSearch,
                                               java.lang.String strChars,
                                               int ipos,
                                               java.util.Vector vQuoteLocs)
Method locateNextUnquotedSingleChar. Return the integer location within strSearch that is first occurance of any of the characters making up strChars
Parameters:
strSearch - The string to search
strChars - A string consisting of single characters to find the first occurance of
ipos - int position within strSearch to begin search
vQuoteLocs - Vector containing Integer objects whose intValue specifies the location of a double quote (") in strText.
Returns:
int

locateNextUnquotedSubstring

public static int locateNextUnquotedSubstring(java.lang.String strSearch,
                                              java.lang.String strFind,
                                              int ipos)
Method locateNextUnquotedSubstring. Return the integer location within strSearch that is first occurance of substring strFind
Parameters:
strSearch - The string to search
strFind - The substring to search for
ipos - int position within strSearch to begin search
Returns:
int

locateNextUnquotedSubstring

public static int locateNextUnquotedSubstring(java.lang.String strSearch,
                                              java.lang.String strFind,
                                              int ipos,
                                              java.util.Vector vQuoteLocs)
Method locateNextUnquotedSubstring. Return the integer location within strSearch that is first occurance of substring strFind
Parameters:
strSearch - The string to search
strFind - The substring to search for
ipos - int position within strSearch to begin search
vQuoteLocs - Vector containing Integer objects whose intValue specifies the location of a double quote (") in strText.
Returns:
int

removeAllNonQuotedWhitespace

public static java.lang.String removeAllNonQuotedWhitespace(java.lang.String strValue)
Method removeAllNonQuotedWhitespace. Return a String that is strValue with all non quoted whitespace (space and tab) removed. (keeps whitespace between double quotes)
Parameters:
strValue - The string to remove non-quoted whitespace
Returns:
String

removeAllNonQuotedWhitespace

public static java.lang.String removeAllNonQuotedWhitespace(java.lang.String strValue,
                                                            java.util.Vector vQuoteLocs)
Method removeAllNonQuotedWhitespace. Return a String that is strValue with all non quoted whitespace (space and tab) removed. (keeps whitespace between double quotes)
Parameters:
strValue - The string to remove non-quoted whitespace
vQuoteLocs - Vector containing Integer objects whose intValue specifies the location of a double quote (") in strText.
Returns:
String

replaceString

public static java.lang.String replaceString(java.lang.String strSearch,
                                             java.lang.String strReplace,
                                             int ibegin,
                                             int iend)
Method replaceString. Return a strSearch with strReplace inserted over the locations from ibegin to iend
Parameters:
strSearch - The string to search
strReplace - The replacement string
ibegin - int location to begin replacement
iend - int location to end replacement
Returns:
String

reverse

public static java.lang.String reverse(java.lang.String s)
Method reverse. Return string s with the characters making it up from right to left
Parameters:
s - The string to reverse
Returns:
String

isLegalVarName

public static boolean isLegalVarName(java.lang.String strVarName)
Method isLegalVarName. Return a boolean T/F specifying wheather or not strVarName is a legal variable name within SAFS
Parameters:
strVarName - The variable name to test
Returns:
boolean

isValidNonStdChar

public static boolean isValidNonStdChar(char c)
Method isValidNonStdChar. Return boolean T/F specifying wheather or not the char c is a valid non standard character for SAFS variable names
Parameters:
c - The char to test
Returns:
boolean