planetj.util
Class CasedStringBuffer

java.lang.Object
  extended byplanetj.util.CasedStringBuffer

public class CasedStringBuffer
extends java.lang.Object

StringBuffer substitute which has special methods for working with mixed case Strings

Author:
Justin

Constructor Summary
CasedStringBuffer(int initialCapacity)
          Creates a new CasedStringBuffer with the specified initial capacity
CasedStringBuffer(java.lang.String initialString)
          Creates a new CasedStringBuffer with the specified initial String
 
Method Summary
 CasedStringBuffer append(java.lang.String s)
          Appends a String
 char charAt(int pos)
          Gets the character (upper or lower case) at the specified position
 int indexOf(java.lang.String s)
          Gets the first index at which a String occurs in this CasedStringBuffer.
 int indexOf(java.lang.String s, boolean ignoreSingleQuoted)
          Gets the first index at which a String occurs in this CasedStringBuffer.
 int indexOf(java.lang.String s, int startingPos)
          Gets the first index at which a String occurs in this CasedStringBuffer, starting at a specified search index.
 int indexOf(java.lang.String s, int startingPos, boolean ignoreSingleQuoted)
          Gets the first index at which a String occurs in this CasedStringBuffer, starting at a specified search index.
 CasedStringBuffer insert(int pos, java.lang.String s)
          Inserts a String into this CasedStringBuffer
 int length()
          Gets the number of characters in this CasedStringBuffer
 char lowerCaseCharAt(int pos)
          Gets the character (converted to lower case) at the specified position
 CasedStringBuffer replace(int start, int end, java.lang.String s)
          Replaces a range of characters in this CasedStringBuffer with a specified String
 java.lang.String substring(int beginIndex)
          Returns a new String which is a substring of this CasedStringBuffer
 java.lang.String substring(int beginIndex, int endIndex)
          Returns a new String which is a substring of this CasedStringBuffer
 java.lang.String toLowerCaseString()
          Converts this CasedStringBuffer into a String (which will only contain lower case chars)
 java.lang.String toString()
          Converts this CasedStringBuffer into a String (which could contain upper and lower case chars)
 java.lang.String toUpperCaseString()
          Converts this CasedStringBuffer into a String (which will only contain upper case chars)
 char upperCaseCharAt(int pos)
          Gets the character (converted to upper case) at the specified position
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CasedStringBuffer

public CasedStringBuffer(java.lang.String initialString)
Creates a new CasedStringBuffer with the specified initial String


CasedStringBuffer

public CasedStringBuffer(int initialCapacity)
Creates a new CasedStringBuffer with the specified initial capacity

Method Detail

append

public CasedStringBuffer append(java.lang.String s)
Appends a String


charAt

public char charAt(int pos)
Gets the character (upper or lower case) at the specified position


indexOf

public int indexOf(java.lang.String s)
Gets the first index at which a String occurs in this CasedStringBuffer. The comparison is NOT case sensitive

Parameters:
s - The String to look for

indexOf

public int indexOf(java.lang.String s,
                   boolean ignoreSingleQuoted)
Gets the first index at which a String occurs in this CasedStringBuffer. The comparison is NOT case sensitive

Parameters:
s - The String to look for
ignoreSingleQuoted - When true, portions of the string which are between single quotes (including the single quote themselves) are not included in the index search

indexOf

public int indexOf(java.lang.String s,
                   int startingPos)
Gets the first index at which a String occurs in this CasedStringBuffer, starting at a specified search index. The comparison is NOT case sensitive

Parameters:
s - The String to look for
startingPos - The index where the search begins

indexOf

public int indexOf(java.lang.String s,
                   int startingPos,
                   boolean ignoreSingleQuoted)
Gets the first index at which a String occurs in this CasedStringBuffer, starting at a specified search index. The comparison is NOT case sensitive

Parameters:
s - The String to look for
startingPos - The index where the search begins
ignoreSingleQuoted - When true, portions of the string which are between single quotes (including the single quotes themselves) are not included in the index search

insert

public CasedStringBuffer insert(int pos,
                                java.lang.String s)
Inserts a String into this CasedStringBuffer

Parameters:
pos - The position of the first character to be inserted
s - The replacement String

length

public int length()
Gets the number of characters in this CasedStringBuffer


lowerCaseCharAt

public char lowerCaseCharAt(int pos)
Gets the character (converted to lower case) at the specified position


replace

public CasedStringBuffer replace(int start,
                                 int end,
                                 java.lang.String s)
Replaces a range of characters in this CasedStringBuffer with a specified String

Parameters:
start - The position of the first character to be replaced
end - The position of the character right after the last character to be replaced
s - The replacement String

substring

public java.lang.String substring(int beginIndex)
Returns a new String which is a substring of this CasedStringBuffer

Parameters:
beginIndex - The index of the first character in the substring. (The substring extends to the end of the characters in this CasedStringBuffer.)

substring

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

Parameters:
beginIndex - The index of the first character in the substring
endIndex - One more than the index of the last character in the substring

toLowerCaseString

public java.lang.String toLowerCaseString()
Converts this CasedStringBuffer into a String (which will only contain lower case chars)


toString

public java.lang.String toString()
Converts this CasedStringBuffer into a String (which could contain upper and lower case chars)


toUpperCaseString

public java.lang.String toUpperCaseString()
Converts this CasedStringBuffer into a String (which will only contain upper case chars)


upperCaseCharAt

public char upperCaseCharAt(int pos)
Gets the character (converted to upper case) at the specified position