|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.string.StringOrBuffer | +--xbn.string.SOBStringBuffer
A StringOrBuffer that wraps around a java.lang.StringBuffer. See StringBuffer.
Source code: SOBStringBuffer.java. Unit tests: See the unit tests for StringOrBuffer.
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
SOBStringBuffer(String s_tr)
Create an SOBStringBuffer. |
|
SOBStringBuffer(StringBuffer str_buffer)
Create an SOBStringBuffer. |
Method Summary | |
void |
append(char c_toAppend)
Append a character onto the end (right). |
void |
append(String s_toAppend)
Append a string onto the end (right). |
void |
appendToLeft(char c_toAppend)
Append a character onto the start. |
void |
appendToLeft(String s_toAppend)
Append a string onto the start. |
char |
charAt(int i_dx)
Get the character located at the requested array index. |
void |
delete(int i_idxLeft,
int i_idxAfterRight)
Delete a range of characters. |
void |
deleteCharAt(int i_dx)
Delete a character. |
boolean |
endsWith(String s_toSearchFor)
Is the search string found at the end of the StringOrBuffer? |
StringBuffer |
getStringBuffer()
Get the StringBuffer for direct manipulation. |
String |
getTrimmed()
Get the value of this StringOrBuffer, after trimming whitespace from the ends. |
void |
insert(int i_dx,
char c_toInsert)
Insert a character. |
void |
insert(int i_dx,
String s_toInsert)
Insert a string. |
boolean |
isString()
Does this StringOrBuffer contain a String? |
int |
length()
How long is this StringOrBuffer? |
void |
setLength(int i_newLength)
Set the length. |
boolean |
startsWith(String s_toSearchFor)
Is the search string found at index 0? |
String |
substring(int i_idxLeft)
Get a range of characters starting at the requested index. |
String |
substring(int i_idxLeft,
int i_idxAfterRight)
Get a range of characters. |
String |
toString()
Get some information about this SOBStringBuffer. |
void |
trim()
Trim whitespace from the value of this StringOrBuffer. |
Methods inherited from class xbn.string.StringOrBuffer |
deleteAll, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, isEmpty, isStringAt, isStringBuffer, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf |
Methods inherited from class xbn.XBNObject |
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SOBStringBuffer(String s_tr)
Create an SOBStringBuffer.
s_tr
- May not be null.public SOBStringBuffer(StringBuffer str_buffer)
Create an SOBStringBuffer.
str_buffer
- The StringBuffer to wrap around. May not be null.Method Detail |
public final StringBuffer getStringBuffer()
Get the StringBuffer for direct manipulation.
public final boolean isString()
StringOrBuffer
Does this StringOrBuffer contain a String?
isString
in class StringOrBuffer
public final String toString()
Get some information about this SOBStringBuffer.
toString
in class Object
getStringBuffer().toString()
public final void trim()
Trim whitespace from the value of this StringOrBuffer.
Equal to [TCInvisible].trim(getStringBuffer())
trim
in class StringOrBuffer
public final String getTrimmed()
StringOrBuffer
Get the value of this StringOrBuffer, after trimming whitespace from the ends. This does not alter the internally-held value.
getTrimmed
in class StringOrBuffer
getStringBuffer().toString().trim()
public final char charAt(int i_dx)
StringOrBuffer
Get the character located at the requested array index.
charAt
in class StringOrBuffer
getStringBuffer().charAt(i_dx)
public final void append(String s_toAppend)
Append a string onto the end (right).
First executes
getStringBuffer().append(s_toAppend)
append
in class StringOrBuffer
xbn.string.StringOrBuffer
s_toAppend
- The string to append.public final void appendToLeft(String s_toAppend)
Append a string onto the start.
Equal to insert(0, s_toAppend)
appendToLeft
in class StringOrBuffer
xbn.string.StringOrBuffer
s_toAppend
- The string to append.public final void insert(int i_dx, String s_toInsert)
Insert a string.
Equal to getStringBuffer().insert(i_dx, s_toInsert)
insert
in class StringOrBuffer
xbn.string.StringOrBuffer
i_dx
- The array index at which s_toInsert should be inserted. Must range 0..[length() - 1]
, inclusive.s_toInsert
- The string to insert.public final void append(char c_toAppend)
Append a character onto the end (right).
First executes
getStringBuffer().append(c_toAppend)
append
in class StringOrBuffer
SOBStringBuffer
(as a StringOrBuffer
).public final void appendToLeft(char c_toAppend)
Append a character onto the start.
Equal to insert(0, c_toAppend)
appendToLeft
in class StringOrBuffer
xbn.string.StringOrBuffer
c_toAppend
- The character to insert.public final void insert(int i_dx, char c_toInsert)
Insert a character.
Equal to getStringBuffer().insert(i_dx, c_toInsert)
insert
in class StringOrBuffer
xbn.string.StringOrBuffer
i_dx
- The array index at which c_toInsert should be inserted. Must range 0..[length() - 1]
, inclusive.c_toInsert
- The character to insert.public final void deleteCharAt(int i_dx)
Delete a character.
Equal to getStringBuffer().deleteCharAt(i_dx)
deleteCharAt
in class StringOrBuffer
xbn.string.StringOrBuffer
i_dx
- The array index containing the character to delete. Must range 0..[length() - 1]
, inclusive.public final void delete(int i_idxLeft, int i_idxAfterRight)
Delete a range of characters.
Equal to getStringBuffer().delete(i_idxLeft, i_idxAfterRight)
delete
in class StringOrBuffer
xbn.string.StringOrBuffer
i_idxLeft
- The array index of the left-most character to be deleted. Must range 0..[length() - 1]
, inclusive, and must be less than or equal to i_idxAfterRight.i_idxAfterRight
- The array index after the right-most to be retrieved. Must be between i_idxLeft and length, inclusive.public final void setLength(int i_newLength)
Set the length.
Equal to getStringBuffer().setLength(i_newLength)
setLength
in class StringOrBuffer
xbn.string.StringOrBuffer
i_newLength
- The desired length. If less than length, then every character at and after (array index) i_newLength is deleted. If greater than length, then spaces are appended to the right hand side until the new length is achieved.public final boolean startsWith(String s_toSearchFor)
StringOrBuffer
Is the search string found at index 0?
startsWith
in class StringOrBuffer
isStringAt(s_toSearchFor, 0)
If s_toSearchFor.length is greater than or equal to length.
public final boolean endsWith(String s_toSearchFor)
StringOrBuffer
Is the search string found at the end of the StringOrBuffer?
endsWith
in class StringOrBuffer
isStringAt(s_toSearchFor, (length() - s_toSearchFor.length()))
If s_toSearchFor.length is greater than or equal to length.
public final int length()
StringOrBuffer
How long is this StringOrBuffer?
length
in class StringOrBuffer
getStringBuffer().length()
public final String substring(int i_idxLeft)
StringOrBuffer
Get a range of characters starting at the requested index.
This returns the same thing as substring(i_idxLeft, (length() - 1))
substring
in class StringOrBuffer
getStringBuffer().substring(i_idxLeft)
public final String substring(int i_idxLeft, int i_idxAfterRight)
StringOrBuffer
Get a range of characters.
See substring.
substring
in class StringOrBuffer
getStringBuffer().substring(i_idxLeft, i_idxAfterRight)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/xbnjava