com.zipxap.vfs.dal.utility
Class StringPlus

java.lang.Object
  extended by com.zipxap.vfs.dal.utility.StringPlus

public class StringPlus
extends java.lang.Object

This is essentially a wrapper around String with some new function. But in addition, it is designed for longer-term analysis than a standard String. In other words, it is designed to handle repeat-calls to methods without having to recalculate things (for instance uppercase/lowercase). Obviously there is a memory tradeoff here.


Constructor Summary
StringPlus(java.lang.String text)
           
 
Method Summary
 char charAt(int index)
          Returns the char value at the specified index.
 int codePointAt(int index)
          Returns the character (Unicode code point) at the specified index.
 int codePointBefore(int index)
          Returns the character (Unicode code point) before the specified index.
 int codePointCount(int beginIndex, int endIndex)
          Returns the number of Unicode code points in the specified text range of this String.
 int compareTo(java.lang.String anotherString)
          Compares two strings lexicographically.
 int compareToIgnoreCase(java.lang.String str)
          Compares two strings lexicographically, ignoring case differences.
 java.lang.String concat(java.lang.String str)
          Concatenates the specified string to the end of this string.
 boolean contains(java.lang.CharSequence s)
          Returns true if and only if this string contains the specified sequence of char values.
 boolean contentEquals(java.lang.CharSequence cs)
          Compares this string to the specified CharSequence.
 boolean contentEquals(java.lang.StringBuffer sb)
          Compares this string to the specified StringBuffer.
 boolean endsWith(java.lang.String suffix)
          Tests if this string ends with the specified suffix.
 boolean equals(java.lang.Object anObject)
          Compares this string to the specified object.
 boolean equalsIgnoreCase(java.lang.String anotherString)
          Compares this String to another String, ignoring case considerations.
 byte[] getBytes()
          Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
 byte[] getBytes(java.nio.charset.Charset charset)
          Encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array.
 byte[] getBytes(java.lang.String charsetName)
          Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array.
 void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
          Copies characters from this string into the destination character array.
 int getLineNumber(int absoluteColumnIndex)
          Retrieves the line number containing the given absolute column index.
 SuperPhrase getNextConstruct(Construct construct, int startIndex, boolean ignoreCase)
          Returns a SuperPhrase containing an instance of the given Construct, else null if it was not found.
 SuperPhrase getNextConstruct(Construct construct, int startIndex, int endIndex, boolean ignoreCase)
          Returns a SuperPhrase containing an instance of the given Construct, else null if it was not found.
 int getRelativeColumnIndex(int absoluteColumnIndex)
          Retrieves the column index relative to the line this column belongs to.
 int hashCode()
          Returns a hash code for this string.
 int indexOf(int ch)
          Returns the index within this string of the first occurrence of the specified character.
 int indexOf(int ch, int fromIndex)
          Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
 int indexOf(int ch, int fromIndex, int toIndex)
          Returns the index within this string of the first occurrence of the specified character, between the specified fromIndex and toIndex.
 int indexOf(java.lang.String str)
          Returns the index within this string of the first occurrence of the specified substring.
 int indexOf(java.lang.String str, int fromIndex)
          Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
 int indexOf(java.lang.String str, int fromIndex, boolean ignoreCase)
          Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
 int indexOf(java.lang.String str, int fromIndex, int toIndex)
          Returns the index within this string of the first occurrence of the specified substring, between the specified fromIndex and toIndex.
 int indexOfBackwards(java.lang.String searchString, int index, boolean ignoreCase)
          Returns the index within this string of the first occurrence of the specified substring, working backwards from the specified index.
 int indexOfConstruct(Construct construct)
          Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfConstruct(Construct construct, boolean ignoreCase)
          Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfConstruct(Construct construct, int fromIndex)
          Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfConstruct(Construct construct, int fromIndex, boolean ignoreCase)
          Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfConstruct(Construct construct, int startIndex, int endIndex, boolean ignoreCase)
          Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfEndOfConstruct(Construct construct)
          Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfEndOfConstruct(Construct construct, boolean ignoreCase)
          Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfEndOfConstruct(Construct construct, int fromIndex)
          Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfEndOfConstruct(Construct construct, int fromIndex, boolean ignoreCase)
          Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfEndOfConstruct(Construct construct, int startIndex, int endIndex, boolean ignoreCase)
          Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.
 int indexOfEndOfLitteral(int startingQuoteIndex, char escapeCharacter)
          Finds the end index of the litteral beginning at the specified startingQuoteIndex
 int indexOfEndOfLitteral(int startingQuoteIndex, char escapeCharacter, int endIndex)
          Finds the end index of the litteral beginning at the specified startingQuoteIndex
 int indexOfEndOfNumber(int startIndex)
          Find the index following the last digit of the simple number starting at startIndex.
 int indexOfIgnoreCase(java.lang.String searchString)
           
 int indexOfIgnoreCase(java.lang.String searchString, int startIndex)
          Returns the index within this string of the first occurrence of the specified substring, ignoring case, and starting at the specified index.
static int indexOfIgnoreCase(java.lang.String text, java.lang.String searchString)
           
static int indexOfIgnoreCase(java.lang.String text, java.lang.String searchString, int startIndex)
          Returns the index within this string of the first occurrence of the specified substring, ignoring case, and starting at the specified index.
 int indexOfMatchingParenthesis(int parenIndex, boolean complainIfNotFound)
          matches on (),[], {}, and <>
 int indexOfNextAlphaNumeric(int index)
          Locates the next alpha-numeric character
 int indexOfNextAlphaNumericBackwards(int index)
          Locates the next alpha-numeric character, working backwards from the specified index
 int indexOfNextNonAlphaNumeric(int index)
          Locates the next non-whitespace, non-alphanumeric character character
 int indexOfNextNonAlphaNumericBackwards(int index)
          Locates the next non-whitespace, non-alphanumeric character, working backwards from the specified index
 int indexOfNextNonAlphaNumericPlus(int index, int[] additionalValidCodePoints, boolean includeWhitespace)
          Locates the next non-whitespace, non-alphanumeric character character
 int indexOfNextNonWhitespace(int index)
          Locates the next non-whitespace character
 int indexOfNextNonWhitespaceBackwards(int index)
          Locates the next non-whitespace character, working backwards from the specified index
 int indexOfNextWhitespace(int index)
          Locates the next whitespace character
 int indexOfNextWhitespaceBackwards(int index)
          Locates the next whitespace character, working backwards from the specified index
 int indexOfStartOfLitteralBackwards(int endingQuoteIndex, char escapeCharacter)
          Finds the end index of the litteral beginning at the specified startingQuoteIndex
 int indexOfStartOfNumberBackwards(int endIndex)
          Find the index of the first digit of the simple number starting before endIndex and eding on or after endIndex.
 int indexOfUnescaped(char character, char escapeCharacter, int startIndex)
          Finds the index of the first unescaped instance of the specified character.
 int indexOfUnescaped(char character, char escapeCharacter, int startIndex, int endIndex)
          Finds the index of the first unescaped instance of the specified character.
 int indexOfWord(java.lang.String searchWord)
          Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.
 int indexOfWord(java.lang.String searchWord, boolean ignoreCase)
          Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.
 int indexOfWord(java.lang.String searchWord, int startIndex)
          Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.
 int indexOfWord(java.lang.String searchWord, int startIndex, boolean ignoreCase)
          Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.
 int indexOfWord(java.lang.String searchWord, int startIndex, int endIndex, boolean ignoreCase)
          Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.
 java.lang.String intern()
          Returns a canonical representation for the string object.
 boolean isAlgebraicOperatorAtIndex(int index)
          Determine if the character at the specified index is an algebraic operator
 boolean isConstructAtIndex(int index, Construct construct, boolean ignoreCase)
          Tests if the specified construct is located at the specified index.
 boolean isEmpty()
          Returns true if, and only if, length() is 0.
 boolean isPossibleStartOfNumber(int index)
          Determine if this could possibly be the beginning of a number
 boolean isSubstringAtIndex(int index, java.lang.String substring)
          Tests if the specified substring occurs at the specified index.
 boolean isSubstringAtIndex(int index, java.lang.String substring, boolean ignoreCase)
          Tests if the specified substring occurs at the specified index.
static boolean isSubstringAtIndex(java.lang.String text, int index, java.lang.String substring, boolean ignoreCase)
          Tests if the specified substring occurs at the specified index.
 boolean isSubstringAtIndexIgnoreCase(int index, java.lang.String substring)
          Tests if the specified substring occurs at the specified index, ignoring case.
static boolean isSubstringAtIndexIgnoreCase(java.lang.String text, int index, java.lang.String substring)
          Tests if the specified substring occurs at the specified index, ignoring case.
 boolean isWhitespaceAtIndex(int index)
          Tests if there is a whitespace character (' ', '\n', '\r', or '\t') at the specified index.
static boolean isWhitespaceCharacter(int codePoint)
           
 int lastIndexOf(int ch)
          Returns the index within this string of the last occurrence of the specified character.
 int lastIndexOf(int ch, int fromIndex)
          Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
 int lastIndexOf(java.lang.String str)
          Returns the index within this string of the rightmost occurrence of the specified substring.
 int lastIndexOf(java.lang.String str, int fromIndex)
          Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index.
 int length()
          Returns the length of this string.
 boolean matches(java.lang.String regex)
          Tells whether or not this string matches the given regular expression.
 int offsetByCodePoints(int index, int codePointOffset)
          Returns the index within this String that is offset from the given index by codePointOffset code points.
static java.lang.String padWithSpaces(java.lang.String value, int size)
           
 boolean regionMatches(boolean ignoreCase, int toffset, java.lang.String other, int ooffset, int len)
          Tests if two string regions are equal.
 boolean regionMatches(int toffset, java.lang.String other, int ooffset, int len)
          Tests if two string regions are equal.
static java.lang.String repeatCharacter(char c, int nTimesToRepeat)
           
 java.lang.String replace(char oldChar, char newChar)
          Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
 java.lang.String replace(java.lang.CharSequence target, java.lang.CharSequence replacement)
          Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.
 java.lang.String replaceAll(java.lang.String regex, java.lang.String replacement)
          Replaces each substring of this string that matches the given regular expression with the given replacement.
 java.lang.String replaceConstruct(Construct target, java.lang.String replacement, boolean ignoreCase)
          Replaces each substring of this string that matches the construct target sequence with the specified literal replacement sequence.
 java.lang.String replaceFirst(java.lang.String regex, java.lang.String replacement)
          Replaces the first substring of this string that matches the given regular expression with the given replacement.
 java.util.List<java.lang.String> split(char c, boolean trimElements)
          Splits this string around matches of the given character
 java.lang.String[] split(java.lang.String regex)
          Splits this string around matches of the given regular expression.
 java.lang.String[] split(java.lang.String regex, boolean trimElements)
          Splits this string around matches of the given regular expression.
 java.lang.String[] split(java.lang.String regex, int limit)
          Splits this string around matches of the given regular expression.
 boolean startsWith(java.lang.String prefix)
          Splits this string around matches of the given regular expression.
 boolean startsWith(java.lang.String prefix, int toffset)
          Splits this string around matches of the given regular expression.
 java.lang.CharSequence subSequence(int beginIndex, int endIndex)
          Splits this string around matches of the given regular expression.
 java.lang.String substring(int beginIndex)
          Splits this string around matches of the given regular expression.
 java.lang.String substring(int beginIndex, int endIndex)
          Returns a new string that is a substring of this string.
 char[] toCharArray()
          Converts this string to a new character array.
 java.lang.String toLowerCase()
          Converts all of the characters in this String to lower case using the rules of the default locale.
 java.lang.String toLowerCase(java.util.Locale locale)
          Converts all of the characters in this String to lower case using the rules of the default locale.
 java.lang.String toString()
           
 java.lang.String toUpperCase()
          Converts all of the characters in this String to upper case using the rules of the default locale.
 java.lang.String toUpperCase(java.util.Locale locale)
          Converts all of the characters in this String to upper case using the rules of the given Locale.
 java.lang.String trim()
          Returns a copy of the string, with leading and trailing whitespace omitted.
static java.lang.String trim(java.lang.String text)
           
 java.lang.String trimSpaces()
          Trim only ' ' characters.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringPlus

public StringPlus(java.lang.String text)
Method Detail

charAt

public char charAt(int index)
Returns the char value at the specified index.

Parameters:
index -
Returns:
the char value at the specified index

codePointAt

public int codePointAt(int index)
Returns the character (Unicode code point) at the specified index.

Parameters:
index -
Returns:
the character (Unicode code point) at the specified index

codePointBefore

public int codePointBefore(int index)
Returns the character (Unicode code point) before the specified index.

Parameters:
index -
Returns:
the character (Unicode code point) before the specified index

codePointCount

public int codePointCount(int beginIndex,
                          int endIndex)
Returns the number of Unicode code points in the specified text range of this String.

Parameters:
beginIndex -
endIndex -
Returns:
the number of Unicode code points in the specified text range of this String

compareTo

public int compareTo(java.lang.String anotherString)
Compares two strings lexicographically.

Parameters:
anotherString -
Returns:
the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument.

compareToIgnoreCase

public int compareToIgnoreCase(java.lang.String str)
Compares two strings lexicographically, ignoring case differences.

Parameters:
str -
Returns:
a negative integer, zero, or a positive integer as the specified String is greater than, equal to, or less than this String, ignoring case considerations

concat

public java.lang.String concat(java.lang.String str)
Concatenates the specified string to the end of this string.

Parameters:
str -
Returns:
a string that represents the concatenation of this object's characters followed by the string argument's characters.

contains

public boolean contains(java.lang.CharSequence s)
Returns true if and only if this string contains the specified sequence of char values.

Parameters:
s -
Returns:
true if this string contains s, false otherwise

contentEquals

public boolean contentEquals(java.lang.CharSequence cs)
Compares this string to the specified CharSequence.

Parameters:
cs -
Returns:

contentEquals

public boolean contentEquals(java.lang.StringBuffer sb)
Compares this string to the specified StringBuffer.

Parameters:
sb -
Returns:

endsWith

public boolean endsWith(java.lang.String suffix)
Tests if this string ends with the specified suffix.

Parameters:
suffix -
Returns:

equals

public boolean equals(java.lang.Object anObject)
Compares this string to the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
anObject -
Returns:

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.String anotherString)
Compares this String to another String, ignoring case considerations.

Parameters:
anotherString -
Returns:

getBytes

public byte[] getBytes()
Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.

Returns:

getBytes

public byte[] getBytes(java.nio.charset.Charset charset)
Encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array.

Parameters:
charset -
Returns:

getBytes

public byte[] getBytes(java.lang.String charsetName)
                throws java.io.UnsupportedEncodingException
Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array.

Parameters:
charsetName -
Returns:
Throws:
java.io.UnsupportedEncodingException

getChars

public void getChars(int srcBegin,
                     int srcEnd,
                     char[] dst,
                     int dstBegin)
Copies characters from this string into the destination character array.

Parameters:
srcBegin -
srcEnd -
dst -
dstBegin -

hashCode

public int hashCode()
Returns a hash code for this string.

Overrides:
hashCode in class java.lang.Object
Returns:

indexOf

public int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character.

Parameters:
ch -
Returns:

indexOf

public int indexOf(int ch,
                   int fromIndex)
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.

Parameters:
ch -
fromIndex -
Returns:

indexOf

public int indexOf(int ch,
                   int fromIndex,
                   int toIndex)
Returns the index within this string of the first occurrence of the specified character, between the specified fromIndex and toIndex.

Parameters:
ch -
fromIndex -
toIndex - exclusive
Returns:

indexOf

public int indexOf(java.lang.String str)
Returns the index within this string of the first occurrence of the specified substring.

Parameters:
str -
Returns:

indexOf

public int indexOf(java.lang.String str,
                   int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.

Parameters:
str -
fromIndex -
Returns:

indexOf

public int indexOf(java.lang.String str,
                   int fromIndex,
                   int toIndex)
Returns the index within this string of the first occurrence of the specified substring, between the specified fromIndex and toIndex.

Parameters:
str -
fromIndex -
toIndex -
Returns:

indexOf

public int indexOf(java.lang.String str,
                   int fromIndex,
                   boolean ignoreCase)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.

Parameters:
str -
fromIndex -
Returns:

indexOfBackwards

public int indexOfBackwards(java.lang.String searchString,
                            int index,
                            boolean ignoreCase)
Returns the index within this string of the first occurrence of the specified substring, working backwards from the specified index.

Parameters:
searchString -
index -
ignoreCase -
Returns:

indexOfConstruct

public int indexOfConstruct(Construct construct)
Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
Returns:

indexOfConstruct

public int indexOfConstruct(Construct construct,
                            boolean ignoreCase)
Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
ignoreCase -
Returns:

indexOfConstruct

public int indexOfConstruct(Construct construct,
                            int fromIndex)
Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
fromIndex -
Returns:

indexOfConstruct

public int indexOfConstruct(Construct construct,
                            int fromIndex,
                            boolean ignoreCase)
Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
fromIndex -
ignoreCase -
Returns:

indexOfConstruct

public int indexOfConstruct(Construct construct,
                            int startIndex,
                            int endIndex,
                            boolean ignoreCase)
Returns the index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
str -
fromIndex -
Returns:

indexOfEndOfConstruct

public int indexOfEndOfConstruct(Construct construct)
Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
Returns:

indexOfEndOfConstruct

public int indexOfEndOfConstruct(Construct construct,
                                 boolean ignoreCase)
Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
ignoreCase -
Returns:

indexOfEndOfConstruct

public int indexOfEndOfConstruct(Construct construct,
                                 int fromIndex)
Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
fromIndex -
Returns:

indexOfEndOfConstruct

public int indexOfEndOfConstruct(Construct construct,
                                 int fromIndex,
                                 boolean ignoreCase)
Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
construct -
fromIndex -
ignoreCase -
Returns:

indexOfEndOfConstruct

public int indexOfEndOfConstruct(Construct construct,
                                 int startIndex,
                                 int endIndex,
                                 boolean ignoreCase)
Returns the end index within this string of the first occurrence of the specified construct, starting at the specified index.

Parameters:
str -
fromIndex -
Returns:

indexOfEndOfLitteral

public int indexOfEndOfLitteral(int startingQuoteIndex,
                                char escapeCharacter)
Finds the end index of the litteral beginning at the specified startingQuoteIndex

Parameters:
startingQuoteIndex - The index of the quote character that signifies the beginning of the litteral
escapeCharacter - the escape character
Returns:
the index of the matching quote character, else -1 if the end of the litteral could not be found

indexOfUnescaped

public int indexOfUnescaped(char character,
                            char escapeCharacter,
                            int startIndex)
Finds the index of the first unescaped instance of the specified character.

Parameters:
character - The character to locate
escapeCharacter - The character used to indicate an escaped character
startIndex - The index to begin searching from
Returns:
the index of the first unescaped instance of the specified character.

indexOfUnescaped

public int indexOfUnescaped(char character,
                            char escapeCharacter,
                            int startIndex,
                            int endIndex)
Finds the index of the first unescaped instance of the specified character.

Parameters:
character - The character to locate
escapeCharacter - The character used to indicate an escaped character
startIndex - The index to begin searching from
endIndex - The index to end searching at
Returns:
the index of the first unescaped instance of the specified character.

indexOfEndOfLitteral

public int indexOfEndOfLitteral(int startingQuoteIndex,
                                char escapeCharacter,
                                int endIndex)
Finds the end index of the litteral beginning at the specified startingQuoteIndex

Parameters:
startingQuoteIndex - The index of the quote character that signifies the beginning of the litteral
escapeCharacter - the escape character
endIndex - the index at which to stop searching for the end of the litteral
Returns:
the index of the matching quote character, else -1 if the end of the litteral could not be found

indexOfStartOfLitteralBackwards

public int indexOfStartOfLitteralBackwards(int endingQuoteIndex,
                                           char escapeCharacter)
Finds the end index of the litteral beginning at the specified startingQuoteIndex

Parameters:
startingQuoteIndex - The index of the quote character that signifies the beginning of the litteral
escapeCharacter - the escape character
Returns:
the index of the matching quote character, else -1 if the end of the litteral could not be found

isPossibleStartOfNumber

public boolean isPossibleStartOfNumber(int index)
Determine if this could possibly be the beginning of a number

Parameters:
index -
Returns:
true if the character at the specified index is one of; '.',isDigit(),'-',or'+'

indexOfEndOfNumber

public int indexOfEndOfNumber(int startIndex)
Find the index following the last digit of the simple number starting at startIndex. This method DOES NOT find the end of a complex number (array).

Parameters:
startIndex - the index where the number begins. This method will still find the end number even if startIndex is pointing towards some digit within the number after the first digit.
Returns:
the index following the last digit of the number starting at startIndex

indexOfStartOfNumberBackwards

public int indexOfStartOfNumberBackwards(int endIndex)
Find the index of the first digit of the simple number starting before endIndex and eding on or after endIndex. This method DOES NOT find the first digit of a complex number (array).

Parameters:
startIndex - the index where the number begins. This method will still find the end number even if startIndex is pointing towards some digit within the number after the first digit.
Returns:
the index following the last digit of the number starting at startIndex

isAlgebraicOperatorAtIndex

public boolean isAlgebraicOperatorAtIndex(int index)
Determine if the character at the specified index is an algebraic operator

Parameters:
index -
Returns:
true if the char at the specified index is one of; '+','-','/','*','^','=','!','<', or '>'

getNextConstruct

public SuperPhrase getNextConstruct(Construct construct,
                                    int startIndex,
                                    boolean ignoreCase)
Returns a SuperPhrase containing an instance of the given Construct, else null if it was not found.

Parameters:
construct -
startIndex -
ignoreCase -
Returns:

getNextConstruct

public SuperPhrase getNextConstruct(Construct construct,
                                    int startIndex,
                                    int endIndex,
                                    boolean ignoreCase)
Returns a SuperPhrase containing an instance of the given Construct, else null if it was not found.

Parameters:
construct -
startIndex -
endIndex -
ignoreCase -
Returns:

indexOfIgnoreCase

public int indexOfIgnoreCase(java.lang.String searchString)

indexOfIgnoreCase

public static int indexOfIgnoreCase(java.lang.String text,
                                    java.lang.String searchString)

indexOfMatchingParenthesis

public int indexOfMatchingParenthesis(int parenIndex,
                                      boolean complainIfNotFound)
matches on (),[], {}, and <>


indexOfNextAlphaNumeric

public int indexOfNextAlphaNumeric(int index)
Locates the next alpha-numeric character

Parameters:
index -
Returns:
the index of the next alpha-numeric character, else -1 if none was found

indexOfNextNonAlphaNumeric

public int indexOfNextNonAlphaNumeric(int index)
Locates the next non-whitespace, non-alphanumeric character character

Parameters:
index -
Returns:
the index of the next alpha-numeric character, else -1 if none was found

indexOfNextNonAlphaNumericPlus

public int indexOfNextNonAlphaNumericPlus(int index,
                                          int[] additionalValidCodePoints,
                                          boolean includeWhitespace)
Locates the next non-whitespace, non-alphanumeric character character

Parameters:
index -
additionalValidCodePoints - A list of additional characters (code points) that are acceptable to skip.
Returns:
the index of the next alpha-numeric character, else -1 if none was found

indexOfNextAlphaNumericBackwards

public int indexOfNextAlphaNumericBackwards(int index)
Locates the next alpha-numeric character, working backwards from the specified index

Parameters:
index -
Returns:
the index of the next non-whitespace character, else -1 if none was found

indexOfNextNonAlphaNumericBackwards

public int indexOfNextNonAlphaNumericBackwards(int index)
Locates the next non-whitespace, non-alphanumeric character, working backwards from the specified index

Parameters:
index -
Returns:
the index of the next non-whitespace character, else -1 if none was found

indexOfNextWhitespace

public int indexOfNextWhitespace(int index)
Locates the next whitespace character

Parameters:
index -
Returns:
the index of the next whitespace character, else -1 if none was found

indexOfNextWhitespaceBackwards

public int indexOfNextWhitespaceBackwards(int index)
Locates the next whitespace character, working backwards from the specified index

Parameters:
index -
Returns:
the index of the next whitespace character, else -1 if none was found

indexOfNextNonWhitespace

public int indexOfNextNonWhitespace(int index)
Locates the next non-whitespace character

Parameters:
index -
Returns:
the index of the next non-whitespace character, else -1 if none was found

indexOfNextNonWhitespaceBackwards

public int indexOfNextNonWhitespaceBackwards(int index)
Locates the next non-whitespace character, working backwards from the specified index

Parameters:
index -
Returns:
the index of the next non-whitespace character, else -1 if none was found

indexOfIgnoreCase

public int indexOfIgnoreCase(java.lang.String searchString,
                             int startIndex)
Returns the index within this string of the first occurrence of the specified substring, ignoring case, and starting at the specified index.

Parameters:
searchString -
startIndex -
Returns:

indexOfIgnoreCase

public static int indexOfIgnoreCase(java.lang.String text,
                                    java.lang.String searchString,
                                    int startIndex)
Returns the index within this string of the first occurrence of the specified substring, ignoring case, and starting at the specified index.

Parameters:
searchString -
startIndex -
Returns:

indexOfWord

public int indexOfWord(java.lang.String searchWord)
Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.

Parameters:
searchWord -
Returns:

indexOfWord

public int indexOfWord(java.lang.String searchWord,
                       boolean ignoreCase)
Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.

Parameters:
searchWord -
ignoreCase -
Returns:

indexOfWord

public int indexOfWord(java.lang.String searchWord,
                       int startIndex)
Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.

Parameters:
searchWord -
startIndex -
Returns:

indexOfWord

public int indexOfWord(java.lang.String searchWord,
                       int startIndex,
                       boolean ignoreCase)
Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.

Parameters:
searchWord -
startIndex -
ignoreCase -
Returns:

indexOfWord

public int indexOfWord(java.lang.String searchWord,
                       int startIndex,
                       int endIndex,
                       boolean ignoreCase)
Locates the first occurence of the specified searchWord that is surrounded on either side by only non-alpha-numeric characters.

Parameters:
searchWord -
startIndex -
endIndex -
Returns:

isSubstringAtIndex

public boolean isSubstringAtIndex(int index,
                                  java.lang.String substring)
Tests if the specified substring occurs at the specified index.

Parameters:
index -
substring -
Returns:

isSubstringAtIndex

public static boolean isSubstringAtIndex(java.lang.String text,
                                         int index,
                                         java.lang.String substring,
                                         boolean ignoreCase)
Tests if the specified substring occurs at the specified index.

Parameters:
text -
index -
substring -
Returns:

isSubstringAtIndex

public boolean isSubstringAtIndex(int index,
                                  java.lang.String substring,
                                  boolean ignoreCase)
Tests if the specified substring occurs at the specified index.

Parameters:
index -
substring -
Returns:

isSubstringAtIndexIgnoreCase

public static boolean isSubstringAtIndexIgnoreCase(java.lang.String text,
                                                   int index,
                                                   java.lang.String substring)
Tests if the specified substring occurs at the specified index, ignoring case.

Parameters:
text -
index -
substring -
Returns:

isSubstringAtIndexIgnoreCase

public boolean isSubstringAtIndexIgnoreCase(int index,
                                            java.lang.String substring)
Tests if the specified substring occurs at the specified index, ignoring case.

Parameters:
index -
substring -
Returns:

isConstructAtIndex

public boolean isConstructAtIndex(int index,
                                  Construct construct,
                                  boolean ignoreCase)
Tests if the specified construct is located at the specified index.

Parameters:
index -
construct -
Returns:

isWhitespaceAtIndex

public boolean isWhitespaceAtIndex(int index)
Tests if there is a whitespace character (' ', '\n', '\r', or '\t') at the specified index.

Parameters:
index -
Returns:

isWhitespaceCharacter

public static boolean isWhitespaceCharacter(int codePoint)

intern

public java.lang.String intern()
Returns a canonical representation for the string object.

Returns:

isEmpty

public boolean isEmpty()
Returns true if, and only if, length() is 0.

Returns:

lastIndexOf

public int lastIndexOf(int ch)
Returns the index within this string of the last occurrence of the specified character.

Parameters:
ch -
Returns:

lastIndexOf

public int lastIndexOf(int ch,
                       int fromIndex)
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.

Parameters:
ch -
fromIndex -
Returns:

lastIndexOf

public int lastIndexOf(java.lang.String str)
Returns the index within this string of the rightmost occurrence of the specified substring.

Parameters:
str -
Returns:

lastIndexOf

public int lastIndexOf(java.lang.String str,
                       int fromIndex)
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index.

Parameters:
str -
fromIndex -
Returns:

length

public int length()
Returns the length of this string.

Returns:

matches

public boolean matches(java.lang.String regex)
Tells whether or not this string matches the given regular expression.

Parameters:
regex -
Returns:

offsetByCodePoints

public int offsetByCodePoints(int index,
                              int codePointOffset)
Returns the index within this String that is offset from the given index by codePointOffset code points.

Parameters:
index -
codePointOffset -
Returns:

regionMatches

public boolean regionMatches(boolean ignoreCase,
                             int toffset,
                             java.lang.String other,
                             int ooffset,
                             int len)
Tests if two string regions are equal.

Parameters:
ignoreCase -
toffset -
other -
ooffset -
len -
Returns:

regionMatches

public boolean regionMatches(int toffset,
                             java.lang.String other,
                             int ooffset,
                             int len)
Tests if two string regions are equal.

Parameters:
toffset -
other -
ooffset -
len -
Returns:

replace

public java.lang.String replace(char oldChar,
                                char newChar)
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.

Parameters:
oldChar -
newChar -
Returns:

replace

public java.lang.String replace(java.lang.CharSequence target,
                                java.lang.CharSequence replacement)
Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.

Parameters:
target -
replacement -
Returns:

replaceConstruct

public java.lang.String replaceConstruct(Construct target,
                                         java.lang.String replacement,
                                         boolean ignoreCase)
Replaces each substring of this string that matches the construct target sequence with the specified literal replacement sequence.

Parameters:
target -
replacement -
param - ignoreCase
Returns:

replaceAll

public java.lang.String replaceAll(java.lang.String regex,
                                   java.lang.String replacement)
Replaces each substring of this string that matches the given regular expression with the given replacement.

Parameters:
regex -
replacement -
Returns:

replaceFirst

public java.lang.String replaceFirst(java.lang.String regex,
                                     java.lang.String replacement)
Replaces the first substring of this string that matches the given regular expression with the given replacement.

Parameters:
regex -
replacement -
Returns:

split

public java.lang.String[] split(java.lang.String regex)
Splits this string around matches of the given regular expression.

Parameters:
regex -
Returns:

split

public java.lang.String[] split(java.lang.String regex,
                                boolean trimElements)
Splits this string around matches of the given regular expression.

Parameters:
regex -
trimElements -
Returns:
the array of strings computed by splitting this string around matches of the given regular expression

split

public java.lang.String[] split(java.lang.String regex,
                                int limit)
Splits this string around matches of the given regular expression.

Parameters:
regex -
limit -
Returns:

split

public java.util.List<java.lang.String> split(char c,
                                              boolean trimElements)
Splits this string around matches of the given character

Parameters:
c -
trimElements -
Returns:

startsWith

public boolean startsWith(java.lang.String prefix)
Splits this string around matches of the given regular expression.

Parameters:
prefix -
Returns:

startsWith

public boolean startsWith(java.lang.String prefix,
                          int toffset)
Splits this string around matches of the given regular expression.

Parameters:
prefix -
toffset -
Returns:

subSequence

public java.lang.CharSequence subSequence(int beginIndex,
                                          int endIndex)
Splits this string around matches of the given regular expression.

Parameters:
beginIndex -
endIndex -
Returns:

substring

public java.lang.String substring(int beginIndex)
Splits this string around matches of the given regular expression.

Parameters:
beginIndex -
Returns:

substring

public java.lang.String substring(int beginIndex,
                                  int endIndex)
Returns a new string that is a substring of this string.

Parameters:
beginIndex -
endIndex -
Returns:

toCharArray

public char[] toCharArray()
Converts this string to a new character array.

Returns:

toLowerCase

public java.lang.String toLowerCase()
Converts all of the characters in this String to lower case using the rules of the default locale.

Returns:

toLowerCase

public java.lang.String toLowerCase(java.util.Locale locale)
Converts all of the characters in this String to lower case using the rules of the default locale.

Parameters:
locale -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toUpperCase

public java.lang.String toUpperCase()
Converts all of the characters in this String to upper case using the rules of the default locale.

Returns:

toUpperCase

public java.lang.String toUpperCase(java.util.Locale locale)
Converts all of the characters in this String to upper case using the rules of the given Locale.

Parameters:
locale -
Returns:

trim

public static java.lang.String trim(java.lang.String text)

trim

public java.lang.String trim()
Returns a copy of the string, with leading and trailing whitespace omitted.

Returns:

trimSpaces

public java.lang.String trimSpaces()
Trim only ' ' characters. The regular String.trim() method removes all white-space characters.

Parameters:
text - The string to trim.
Returns:
The specified text, will all leading and trailing ' ' characters removed.

padWithSpaces

public static java.lang.String padWithSpaces(java.lang.String value,
                                             int size)

repeatCharacter

public static java.lang.String repeatCharacter(char c,
                                               int nTimesToRepeat)

getRelativeColumnIndex

public int getRelativeColumnIndex(int absoluteColumnIndex)
Retrieves the column index relative to the line this column belongs to.

Parameters:
absoluteColumnIndex -
Returns:
The relative index of the column, the first column starts at 1.

getLineNumber

public int getLineNumber(int absoluteColumnIndex)
Retrieves the line number containing the given absolute column index. Lines are indexed from 1.

Parameters:
absoluteColumnIndex -
Returns:
The line number containing the given absolute column index, the first line is indexed at 1.