|
|||||||||
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.SOBString
A StringOrBuffer that wraps around a java.lang.String. See String.
Source code: SOBString.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 | |
SOBString(String s_tr)
Create an SOBString. |
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 to the start. |
void |
appendToLeft(String s_toAppend)
Append a string to 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? |
String |
getString()
Get the String. |
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 SOBString. |
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 SOBString(String s_tr)
Create an SOBString.
s_tr
- May not be null.Method Detail |
public final String getString()
Get the String.
public final boolean isString()
StringOrBuffer
Does this StringOrBuffer contain a String?
isString
in class StringOrBuffer
public final String toString()
Get some information about this SOBString.
toString
in class Object
getString().toString()
public final int length()
StringOrBuffer
How long is this StringOrBuffer?
length
in class StringOrBuffer
getString().length()
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
getString().trim()
rrpublic final void trim()
Trim whitespace from the value of this StringOrBuffer.
Sets the internally-held string to [internally-held string].trim()
trim
in class StringOrBuffer
public final char charAt(int i_dx)
StringOrBuffer
Get the character located at the requested array index.
charAt
in class StringOrBuffer
getString().charAt(i_dx)
public final void append(String s_toAppend)
Append a string onto the end (right).
This executes
[The internal string] += 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 to the start.
Equal to [The internal string] = [The internal string] + 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 [The internal string] = [The internal string].substring(0, i_dx) + s_toInsert + [The internal string].substring(i_dx, s.length())
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).
This executes
[The internal string] += c_toAppend
append
in class StringOrBuffer
xbn.string.StringOrBuffer
s_toAppend
- The character to insert.public final void appendToLeft(char c_toAppend)
Append a character to the start.
Equal to [The internal string] = [The internal string] + 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 [The internal string] = [The internal string].substring(0, i_dx) + c_toInsert + [The internal string].substring(i_dx, s.length()())
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 [The internal string] = [The internal string].substring(0, i_dx) + [The internal string].substring((i_dx + 1), s.length()())
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 [The internal string] = [The internal string].substring(0, i_dx) + [The internal string].substring(i_idxAfterRight, s.length()())
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)
StringOrBuffer
Set the length.
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
getString().startsWith(s_toSearchFor)
public final boolean endsWith(String s_toSearchFor)
StringOrBuffer
Is the search string found at the end of the StringOrBuffer?
endsWith
in class StringOrBuffer
getString().endsWith(s_toSearchFor)
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
getString().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
getString().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