|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.string.UtilSOB
Random functions for StringOrBuffers. See StringOrBuffer.
Source code: UtilSOB.java. Unit tests: xbn_junit.JUTUtilSOB.java.
Field Summary | |
static String |
sUSOB
To shorten code and Javadoc. |
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
UtilSOB()
Create a UtilSOB. |
Method Summary | |
void |
dupAppend(StringOrBuffer str_orBfr,
String s_toDuplicate,
int i_dupCount)
Append a duplicated string onto the StringOrBuffer. |
i_i_i |
getContainedIdxs(StringOrBuffer[] a_strOrBfr)
If any StringOrBuffer is contained in (or equal to) any other, get information describing the containment. |
i_i_i |
getContainedIdxs(StringOrBuffer[] a_strOrBfr,
GCIConfig gci_config)
If any string is contained in any other, get information describing the containment. |
i_i_i |
getContainedIdxs(StringOrBuffer sob_x,
StringOrBuffer sob_y)
If either string is contained in or equal to the other, get information describing the containment. |
i_i_i |
getContainedIdxs(StringOrBuffer sob_x,
StringOrBuffer sob_y,
GCICTwo gcic_two)
If either string is contained in (or equal to) the other, get information describing the containment. |
SOBStringBuffer |
getDupAppend(StringOrBuffer str_orBfr,
String s_toDuplicate,
int i_dupCount)
Get a copy of the StringOrBuffer (as an SOBStringBuffer), after appending a duplicated string onto it. |
i_i_i_i |
getGSAInfo()
What just happened in the just-called getStringAround?. |
int |
getIdxOf1stCharNIA(StringOrBuffer str_orBfr,
char[] a_char)
Get the array index of the first character that is not a member of the array. |
int |
getIdxOf1stCharNIA(StringOrBuffer str_orBfr,
char[] a_char,
boolean b_validateAOC)
Get the array index of the first character that is not a member of the array. |
int |
getIdxOf1stCharNIA(StringOrBuffer str_orBfr,
char[] a_char,
int i_idxStart,
int i_idxFirstfterEnd)
Get the array index of the first character that is not a member of the array. |
int |
getIdxOf1stCharNIA(StringOrBuffer str_orBfr,
char[] a_char,
int i_idxStart,
int i_idxFirstfterEnd,
boolean b_validateAOC)
Get the array index of the first character that does not exist in the array. |
int |
getIdxOf1stNonWS(StringOrBuffer str_orBfr)
Get the array index of the first non-white-space character. |
int |
getIdxOfLastCharNIA(StringOrBuffer str_orBfr,
char[] a_char)
Get the array index of the last character that is not a member of the array. |
int |
getIdxOfLastCharNIA(StringOrBuffer str_orBfr,
char[] a_char,
boolean b_validateAOC)
Get the array index of the last character that is not a member of the array. |
int |
getIdxOfLastCharNIA(StringOrBuffer str_orBfr,
char[] a_char,
int i_idxStart,
int i_idxFirstfterEnd)
Get the array index of the last character that is not a member of the array. |
int |
getIdxOfLastCharNIA(StringOrBuffer str_orBfr,
char[] a_char,
int i_idxStart,
int i_idxFirstfterEnd,
boolean b_validateAOC)
Get the array index of the last character that does not exist in the array. |
int |
getIdxOfLastNonWS(StringOrBuffer str_orBfr)
Get the array index of the last non-white-space character. |
StringOrBuffer |
getQuotedLines(StringOrBuffer str_orBfr)
Get a copy of the StringOrBuffer (as an SOBStringBuffer) where each line is quoted. |
StringOrBuffer |
getQuotedLines(StringOrBuffer str_orBfr,
String s_quote)
Get a copy of the StringOrBuffer (as an SOBStringBuffer) where each line is quoted. |
StringOrBuffer |
getQuotedLines(StringOrBuffer str_orBfr,
String s_quoteStart,
String s_quoteEnd)
Get a copy of the StringOrBuffer (as an SOBStringBuffer) where each line is quoted. |
StringOrBuffer |
getQuotedLines(StringOrBuffer str_orBfr,
String s_quoteStart,
String s_quoteEnd,
String s_lineSep)
Get a copy of the StringOrBuffer (as a StringBuffer) where each line is quoted. |
SOBStringBuffer |
getReplaceAll(StringOrBuffer sob_searchIn,
String s_searchFor,
String s_replaceWith)
Return a copy of the provided StringOrBuffer (as an SOBStringBuffer), in which all occurances are replaced. |
SOBStringBuffer |
getReplaceUntil(StringOrBuffer sob_searchIn,
String s_searchFor,
String s_replaceWith)
Replace all occurances, with multiple passes, until no instances of the search string remain. |
SOBString |
getSOBS(StringOrBuffer str_orBfr,
String s_callingFunc)
Create an SOBString from the StringOrBuffer. |
SOBString |
getSOBS(StringOrBuffer str_orBfr,
String s_description,
String s_callingFunc)
Create an SOBString from the StringOrBuffer. |
SOBStringBuffer |
getSOBSB(StringOrBuffer str_orBfr,
String s_callingFunc)
Create an SOBStringBuffer from the StringOrBuffer. |
SOBStringBuffer |
getSOBSB(StringOrBuffer str_orBfr,
String s_description,
String s_callingFunc)
Create an SOBString from the StringOrBuffer. |
String |
getStringAround(StringOrBuffer str_orBfr,
int i_charIdx,
String s_delimLeft,
String s_delimRight,
boolean b_endsOfStrAltDelims,
boolean b_includeDelimiters)
Get a string surrounding the provided character index, having specific delimiters. |
StringOrBuffer |
getVisible(StringOrBuffer str_orBfr)
Get a copy of the StringOrBuffer (as an SOBStringBuffer), where the contents' invisible characters are made visible. |
boolean |
hasDigitsOrInAOC(StringOrBuffer str_orBfr,
boolean b_lettersOkOpt,
char[] ac_legal)
Does the string contain only digits and (other provided) legal characters? |
boolean |
hasDigitsOrInAOC(StringOrBuffer str_orBfr,
boolean b_lettersOkOpt,
char[] ac_legal,
boolean b_validateAOC)
Does the string contain only digits and (other provided) legal characters? |
boolean |
hasLDOrInAOC(StringOrBuffer str_orBfr,
char[] ac_legal)
Does the string contain only letters, digits and (other provided) legal characters? |
boolean |
hasLDOrInAOC(StringOrBuffer str_orBfr,
char[] ac_legal,
boolean b_validateAOC)
Does the string contain only letters, digits and (other provided) legal characters? |
boolean |
hasLegalChars(StringOrBuffer str_orBfr,
char[] ac_legal)
Does the string contain only legal characters? |
boolean |
hasLegalChars(StringOrBuffer str_orBfr,
char[] ac_legal,
boolean b_validateAOC)
Does the string contain only legal characters? |
boolean |
hasLettersOrInAOC(StringOrBuffer str_orBfr,
boolean b_digitsOkOpt,
char[] ac_legal)
Does the string contain only letters and (other provided) legal characters? |
boolean |
hasLettersOrInAOC(StringOrBuffer str_orBfr,
boolean b_digitsOkOpt,
char[] ac_legal,
boolean b_validateAOC)
Does the string contain only letters and (other provided) legal characters? |
boolean |
hasNoIllegalChars(StringOrBuffer str_orBfr,
char[] ac_illegal)
Does the string not contain any illegal characters? |
boolean |
hasNoIllegalChars(StringOrBuffer str_orBfr,
char[] ac_illegal,
boolean b_validateAOC)
Does the string not contain any illegal characters? |
boolean |
hasNoTabSpace(StringOrBuffer str_orBfr)
Does the StringOrBuffer not contain any tab and space characters? |
int |
indexOfWord(StringOrBuffer str_orBfr,
String s_searchWord,
int i_idxLeft,
int i_idxAfterRight)
Find the first occurance of the search string, where it is an entire word (not part of a larger word). |
int |
indexOfWord(StringOrBuffer str_orBfr,
String s_searchWord,
int i_idxLeft,
int i_idxAfterRight,
boolean b_bounded)
Find the left-most occurance of the search string, where it is an entire word (not part of a larger word). |
boolean |
isHexidecimal(StringOrBuffer sob_potentialHex)
Is the value of the StringOrBuffer a valid hexidecimal number?. |
boolean |
isLegal(StringOrBuffer str_orBfr,
boolean b_lettersOkOpt,
boolean b_digitsOkOpt,
char[] ac_legal)
Does the string contain only legal characters? |
boolean |
isLegal(StringOrBuffer str_orBfr,
boolean b_lettersOkOpt,
boolean b_digitsOkOpt,
char[] ac_legal,
boolean b_validateAOC)
Does the string contain only legal characters? |
boolean |
isLetterDigitUnderscore(StringOrBuffer str_orBfr)
Does the string contain only letters, digits and underscores? |
boolean |
isNotDigitsOrInAOC(StringOrBuffer str_orBfr,
boolean b_lettersBadOpt,
char[] ac_legal)
Does the string not contain any digits or (other provided) illegal characters? |
boolean |
isNotDigitsOrInAOC(StringOrBuffer str_orBfr,
boolean b_lettersBadOpt,
char[] ac_legal,
boolean b_validateAOC)
Does the string not contain any digits or (other provided) illegal characters? |
boolean |
isNotIllegal(StringOrBuffer str_orBfr,
boolean b_lettersBadOpt,
boolean b_digitsBadOpt,
char[] ac_illegal)
Does the string not contain any illegal characters? |
boolean |
isNotIllegal(StringOrBuffer str_orBfr,
boolean b_lettersBadOpt,
boolean b_digitsBadOpt,
char[] ac_illegal,
boolean b_validateAOC)
Does the string not contain any illegal characters? |
boolean |
isNotLDOrInAOC(StringOrBuffer str_orBfr,
char[] ac_legal)
Does the string not contain any letters, digits or (other provided) illegal characters? |
boolean |
isNotLDOrInAOC(StringOrBuffer str_orBfr,
char[] ac_legal,
boolean b_validateAOC)
Does the string not contain any letters, digits or (other provided) illegal characters? |
boolean |
isNotLettersOrInAOC(StringOrBuffer str_orBfr,
boolean b_digitsBadOpt,
char[] ac_legal)
Does the string not contain any letters or (other provided) illegal characters? |
boolean |
isNotLettersOrInAOC(StringOrBuffer str_orBfr,
boolean b_digitsBadOpt,
char[] ac_legal,
boolean b_validateAOC)
Does the string not contain any letters or (other provided) illegal characters? |
boolean |
isTabSpace(StringOrBuffer sob_potentialTabSpace)
Does the StringOrBuffer contain only tabs and spaces? |
int |
lastIndexOfWord(StringOrBuffer str_orBfr,
String s_searchWord,
int i_idxLeft,
int i_idxAfterRight)
Find the last occurance of the search string, where it is an entire word (not part of a larger word). |
int |
lastIndexOfWord(StringOrBuffer str_orBfr,
String s_searchWord,
int i_idxLeft,
int i_idxAfterRight,
boolean b_bounded)
Find the right-most occurance of the search string, where it is an entire word (not part of a larger word). |
void |
makeVisible(StringOrBuffer str_orBfr)
Translate the contents of the StringOrBuffer, so all invisible characters are made visible. |
void |
quoteLines(StringOrBuffer str_orBfr)
Quote each line within the StringOrBuffer. |
void |
quoteLines(StringOrBuffer str_orBfr,
String s_quote)
Quote each line within the StringOrBuffer. |
void |
quoteLines(StringOrBuffer str_orBfr,
String s_quoteStart,
String s_quoteEnd)
Quote each line within the StringOrBuffer. |
void |
quoteLines(StringOrBuffer str_orBfr,
String s_quoteStart,
String s_quoteEnd,
String s_lineSep)
Quote each line within the StringOrBuffer. |
int |
replaceAll(StringOrBuffer sob_searchIn,
String s_searchFor,
String s_replaceWith)
Replace all occurances. |
i_i |
replaceUntil(StringOrBuffer sob_searchIn,
String s_searchFor,
String s_replaceWith)
Replace all occurances, with multiple passes, until no instances of the search string remain. |
void |
throwAXIfBadSOB(StringOrBuffer str_orBfr,
String s_sobDescription,
String s_callingFunc)
If the StringOrBuffer is null or empty (the string contained within is zero characters in length), then die. |
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, toString, wait, wait, wait |
Field Detail |
public static final String sUSOB
To shorten code and Javadoc.
Equal to "xbn.string.UtilSOB"
Constructor Detail |
public UtilSOB()
Create a UtilSOB. This constructor does nothing.
Method Detail |
public final int indexOfWord(StringOrBuffer str_orBfr, String s_searchWord, int i_idxLeft, int i_idxAfterRight)
Find the first occurance of the search string, where it is an entire word (not part of a larger word).
indexOfWord(str_orBfr, s_searchWord, i_idxLeft, i_idxAfterRight, true)
public final int indexOfWord(StringOrBuffer str_orBfr, String s_searchWord, int i_idxLeft, int i_idxAfterRight, boolean b_bounded)
Find the left-most occurance of the search string, where it is an entire word (not part of a larger word).
str_orBfr
- The StringOrBuffer in which to search for s_searchWord. Provided directly to str_orBfr.indexOf
.i_idxLeft
- The left-most index to search. Provided directly to str_orBfr.indexOf
.i_idxAfterRight
- The index after the right-most index to search. Provided directly to str_orBfr.indexOf
.b_bounded
- Should the search string be bounded within i_idxLeft and i_idxAfterRight? Provided directly to str_orBfr.indexOf
.(i_idxAfterRight - 1)
, or(str_orBfr.length() - 1)
, or(i_idxAfterRight - 1)
, and the character immediately following is not a letter, digit or underscore.public final int lastIndexOfWord(StringOrBuffer str_orBfr, String s_searchWord, int i_idxLeft, int i_idxAfterRight)
Find the last occurance of the search string, where it is an entire word (not part of a larger word).
lastIndexOfWord(str_orBfr, s_searchWord, i_idxLeft, i_idxAfterRight, true)
public final int lastIndexOfWord(StringOrBuffer str_orBfr, String s_searchWord, int i_idxLeft, int i_idxAfterRight, boolean b_bounded)
Find the right-most occurance of the search string, where it is an entire word (not part of a larger word).
str_orBfr
- The StringOrBuffer in which to search for s_searchWord. Provided directly to str_orBfr.indexOf
.i_idxLeft
- The left-most index to search. Provided directly to str_orBfr.indexOf
.i_idxAfterRight
- The index after the right-most index to search. Provided directly to str_orBfr.indexOf
.b_bounded
- Should the search string be bounded within i_idxLeft and i_idxAfterRight? Provided directly to str_orBfr.indexOf
.(i_idxAfterRight - 1)
, or(str_orBfr.length() - 1)
, or(i_idxAfterRight - 1)
, and the character immediately following is not a letter, digit or underscore.public final StringOrBuffer getQuotedLines(StringOrBuffer str_orBfr)
Get a copy of the StringOrBuffer (as an SOBStringBuffer) where each line is quoted.
quoteLines(getSOBSB(str_orBfr, "getQuotedLines"))
public final StringOrBuffer getQuotedLines(StringOrBuffer str_orBfr, String s_quote)
Get a copy of the StringOrBuffer (as an SOBStringBuffer) where each line is quoted.
quoteLines(getSOBSB(str_orBfr, "getQuotedLines"), s_quote)
public final StringOrBuffer getQuotedLines(StringOrBuffer str_orBfr, String s_quoteStart, String s_quoteEnd)
Get a copy of the StringOrBuffer (as an SOBStringBuffer) where each line is quoted.
quoteLines(getSOBSB(str_orBfr, "getQuotedLines"), s_quoteStart, s_quoteEnd)
public final StringOrBuffer getQuotedLines(StringOrBuffer str_orBfr, String s_quoteStart, String s_quoteEnd, String s_lineSep)
Get a copy of the StringOrBuffer (as a StringBuffer) where each line is quoted.
quoteLines(getSOBSB(str_orBfr, "getQuotedLines"), s_quoteStart, s_quoteEnd, s_lineSep)
public final void quoteLines(StringOrBuffer str_orBfr)
Quote each line within the StringOrBuffer.
Equal to quoteLines(str_orBfr, "'")
public final void quoteLines(StringOrBuffer str_orBfr, String s_quote)
Quote each line within the StringOrBuffer.
Equal to quoteLines(str_orBfr, s_quote, s_quote)
public final void quoteLines(StringOrBuffer str_orBfr, String s_quoteStart, String s_quoteEnd)
Quote each line within the StringOrBuffer.
Equal to quoteLines(str_orBfr, s_quoteStart, s_quoteEnd, sLINE_SEP)
public final void quoteLines(StringOrBuffer str_orBfr, String s_quoteStart, String s_quoteEnd, String s_lineSep)
Quote each line within the StringOrBuffer. Intended for display purposes only, to emphasize the tabs and spaces existing at the ends of each line. See TrimChars.trimAllLines
and makeVisible
.
str_orBfr
- The StringOrBuffer to get a quoted copy of. May not be null.s_quoteStart
- . The quote to put at the beginning of each line. May not be null or zero characters in length.s_quoteEnd
- The quote to put at the end of each line. May not be null or zero characters in length.s_lineSep
- Whatever you define the line separator to be. May not be null or zero characters in length.public final String getStringAround(StringOrBuffer str_orBfr, int i_charIdx, String s_delimLeft, String s_delimRight, boolean b_endsOfStrAltDelims, boolean b_includeDelimiters)
Get a string surrounding the provided character index, having specific delimiters.
For information regarding the call just made to this function, see getGSAInfo.
str_orBfr
- The string to get the substring from. May not be null, and must be long enough such that all these conditions are met:str_orBfr.indexOf(s_delimLeft)
may not equal -1 and the index of the last character in s_delimLeft must equal [i_charIdx - 1] or less. Exception: It is legal for the left delimiter to not exist if b_sosAltLeftDelim equals true.str_orBfr.indexOf(s_delimRight)
may not equal -1 and the index of the first character in s_delimRight must equal i_charIdx or greater. Exception: It is legal for the right delimiter to not exist if b_sosAltRightDelim equals true.i_charIdx
- The character index existing somewhere within str_orBfr, and between s_delimLeft and s_delimRight.s_delimLeft
- The left delimiter, defining the start of the string to be returned. May not be null, or zero characters in length. The left delimiter closest to i_charIdx (on the left) is used.s_delimRight
- The right delimiter, defining the end of the string to be returned. May not be null, or zero characters in length. The left delimiter closest to i_charIdx (on the right) is used.b_endsOfStrAltDelims
- If s_delimLeft does not exist before, and/or s_delimRight does not after i_charIdx, is the start/end of the string (index str_orBfr.length) a legal substitute for s_delimLeft/s_delimRight? If true and s_delimLeft/s_delimRight does not exist, then the start/end of the string is the delimiter. If false, then both s_delimLeft and s_delimRight are required to exist.b_includeDelimiters
- Should s_delimLeft and s_delimRight be included in the string that is returned? If true, yes (when b_eosAltRightDelim equals true, the left and right delimiters are included only if they exist). If false, no.<A HREF="http://sourceforge.net/projects/xbnjava">click here</a>
\"
Value of | Value of getGSAInfo(]... | |||||
b_endsOfStrAltDelims | b_includeDelimiters | Returned value | .i1 | .i2 | .i3 | .i4 |
false | false | http://sourceforge.net/projects/xbnjava |
8 | 9 | 34 | 34 |
false | true | "http://sourceforge.net/projects/xbnjava" |
8 | 8 | 34 | 35 |
Say...
<A HREF=http://sourceforge.net/projects/xbnjava">click here</a>
\"
Value of | Value of getGSAInfo(]... | |||||
b_endsOfStrAltDelims | b_includeDelimiters | Returned value | .i1 | .i2 | .i3 | .i4 |
true | true | <A HREF=http://sourceforge.net/projects/xbnjava" |
8 | 0 | 34 | 35 |
true | false | <A HREF=http://sourceforge.net/projects/xbnjava |
8 | 0 | 34 | 34 |
false | true | AssertException | n/a |
public i_i_i_i getGSAInfo()
What just happened in the just-called getStringAround?. See getStringAround.
s_delimLeft
was found.str_orBfr
that was returned (which may be different than i1, depending on the value of b_includeDelimiters
).s_delimRight
was found.str_orBfr
that was returned (which may or may not be different than i3, depending on the value of b_includeDelimiters
).public final i_i_i getContainedIdxs(StringOrBuffer sob_x, StringOrBuffer sob_y)
If either string is contained in or equal to the other, get information describing the containment.
getContainedIdx(sob_x, sob_y, (new GCICTwo()))
public final i_i_i getContainedIdxs(StringOrBuffer sob_x, StringOrBuffer sob_y, GCICTwo gcic_two)
If either string is contained in (or equal to) the other, get information describing the containment.
Equal to getContainedIdxs((new StringOrBuffer[]{sob_x, sob_y}), gcic_two)
The array is created only once, and populated in this function repeatedly.
public final i_i_i getContainedIdxs(StringOrBuffer[] a_strOrBfr)
If any StringOrBuffer is contained in (or equal to) any other, get information describing the containment.
public final i_i_i getContainedIdxs(StringOrBuffer[] a_strOrBfr, GCIConfig gci_config)
If any string is contained in any other, get information describing the containment.
a_strOrBfr
- The array of StringOrBuffers to analyze for containment. May not be null or zero elements in length, and no element may be null or zero characters in length.public boolean isHexidecimal(StringOrBuffer sob_potentialHex)
Is the value of the StringOrBuffer a valid hexidecimal number?. A hex digit only contains digits and (lowercase) letters from a through f.
sob_potentialHex
- The StringOrBuffer analyzed, to see if it is a hexidecimal number. May not be null or zero characters in length.isLegal(sob_potentialHex, false, true, UtilChar.getAOCHexLetters())
public boolean isTabSpace(StringOrBuffer sob_potentialTabSpace)
Does the StringOrBuffer contain only tabs and spaces?
sob_potentialHex
- The StringOrBuffer analyzed, to see if it contains only tab and space characters. May not be null or zero characters in length.hasLegalChars(sob_potentialTabSpace, UtilChar.getAOCTabSpace())
public boolean hasNoTabSpace(StringOrBuffer str_orBfr)
Does the StringOrBuffer not contain any tab and space characters?
sob_potentialHex
- The StringOrBuffer analyzed, to see if it contains only non-tab and non-space characters. May not be null or zero characters in length.hasNoIllegalChars(str_orBfr, UtilChar.getAOCTabSpace())
public final void dupAppend(StringOrBuffer str_orBfr, String s_toDuplicate, int i_dupCount)
Append a duplicated string onto the StringOrBuffer.
sb_appendTo
- The StringBuffer to append to. May not be null.s_toDuplicate
- The string to duplicate and then append. May not be null or zero characters in length.i_dupCount
- The number of times to duplicate s_toDuplicate. May not be less than zero. If equal to zero, then nothing is appended to sb_appendTo.public final SOBStringBuffer getDupAppend(StringOrBuffer str_orBfr, String s_toDuplicate, int i_dupCount)
Get a copy of the StringOrBuffer (as an SOBStringBuffer), after appending a duplicated string onto it.
dupAppend(getSOBSB(str_orBfr, "getDupAppend"), s_toDuplicate, i_dupCount)
public final int getIdxOf1stNonWS(StringOrBuffer str_orBfr)
Get the array index of the first non-white-space character.
getIdxOf1stCharNIA(str_orBfr, UtilChar.getAOCInvisible(), bFALSE_IN_PRODUCTION)
public final int getIdxOfLastNonWS(StringOrBuffer str_orBfr)
Get the array index of the last non-white-space character.
getIdxOfLastCharNIA(str_orBfr, UtilChar.getAOCInvisible(), bFALSE_IN_PRODUCTION)
public final int getIdxOf1stCharNIA(StringOrBuffer str_orBfr, char[] a_char)
Get the array index of the first character that is not a member of the array.
getIdxOf1stCharNIA(str_orBfr, a_char, bFALSE_IN_PRODUCTION)
public final int getIdxOf1stCharNIA(StringOrBuffer str_orBfr, char[] a_char, boolean b_validateAOC)
Get the array index of the first character that is not a member of the array.
getIdxOf1stCharNIA(str_orBfr, a_char, 0, str_orBfr.length(), b_validateAOC)
public final int getIdxOf1stCharNIA(StringOrBuffer str_orBfr, char[] a_char, int i_idxStart, int i_idxFirstfterEnd)
Get the array index of the first character that is not a member of the array.
getIdxOf1stCharNIA(str_orBfr, a_char, i_idxStart, i_idxFirstfterEnd, bFALSE_IN_PRODUCTION)
public final int getIdxOf1stCharNIA(StringOrBuffer str_orBfr, char[] a_char, int i_idxStart, int i_idxFirstfterEnd, boolean b_validateAOC)
Get the array index of the first character that does not exist in the array.
See getIdxOfLastCharNIA
for parameter documentation. The only difference between this and that is the side/direction searched.
public final int getIdxOfLastCharNIA(StringOrBuffer str_orBfr, char[] a_char)
Get the array index of the last character that is not a member of the array.
getIdxOfLastCharNIA(str_orBfr, a_char, bFALSE_IN_PRODUCTION)
public final int getIdxOfLastCharNIA(StringOrBuffer str_orBfr, char[] a_char, boolean b_validateAOC)
Get the array index of the last character that is not a member of the array.
getIdxOfLastCharNIA(str_orBfr, a_char, 0, length(), b_validateAOC)
public final int getIdxOfLastCharNIA(StringOrBuffer str_orBfr, char[] a_char, int i_idxStart, int i_idxFirstfterEnd)
Get the array index of the last character that is not a member of the array.
getIdxOfLastCharNIA(str_orBfr, a_char, i_idxStart, i_idxFirstfterEnd, bFALSE_IN_PRODUCTION)
public final int getIdxOfLastCharNIA(StringOrBuffer str_orBfr, char[] a_char, int i_idxStart, int i_idxFirstfterEnd, boolean b_validateAOC)
Get the array index of the last character that does not exist in the array.
See getIdxOf1stCharNIA
.
str_orBfr
- The StringOrBuffer to analyze. May not be null, or zero characters in length.a_char
- The array of characters........................... Must be non-null, at least one character in length, and each element must be unique and sorted ascending.i_idxStart
- The first/left-most array index (inclusive) at which to start analyzing. Must be between zero, and length, inclusive, and may not be greater than i_idxFirstfterEnd.i_idxFirstfterEnd
- The last/right-most array index (exclusive) at which to stop analyzing. Must be between zero, and length(), inclusive, and may not be less than or equal to i_idxStart.b_validateAOC
- If true, then it is verified that a_char conforms to its documented restrictions (an AssertException is thrown when any are violated). If false, it is assumed that it does conform. Set this to false only when you are positive a_char is valid, otherwise you will get unpredictable results/errors. Beeeeeeeee careful (reference to Disney's Alladin).public final StringOrBuffer getVisible(StringOrBuffer str_orBfr)
Get a copy of the StringOrBuffer (as an SOBStringBuffer), where the contents' invisible characters are made visible.
makeVisible(getSOBSB(str_orBfr, "getVisible"))
public final void makeVisible(StringOrBuffer str_orBfr)
Translate the contents of the StringOrBuffer, so all invisible characters are made visible.
Specifically each '\n', '\f', '\r' and '\t' is translated to "\\n", "\\f", "\\r", "\\t", respectively.
str_orBfr
- The StringOrBuffer to translate.public boolean isLetterDigitUnderscore(StringOrBuffer str_orBfr)
Does the string contain only letters, digits and underscores?
isLegal(str_orBfr, true, true, new char[] {'_'})
public boolean hasLettersOrInAOC(StringOrBuffer str_orBfr, boolean b_digitsOkOpt, char[] ac_legal)
Does the string contain only letters and (other provided) legal characters?
hasLettersOrInAOC(str_orBfr, b_digitsOkOpt, ac_legal, bFALSE_IN_PRODUCTION)
public boolean hasLettersOrInAOC(StringOrBuffer str_orBfr, boolean b_digitsOkOpt, char[] ac_legal, boolean b_validateAOC)
Does the string contain only letters and (other provided) legal characters?
isLegal(str_orBfr, true, b_digitsOkOpt, ac_legal, b_validateAOC)
public boolean hasDigitsOrInAOC(StringOrBuffer str_orBfr, boolean b_lettersOkOpt, char[] ac_legal)
Does the string contain only digits and (other provided) legal characters?
hasDigitsOrInAOC(str_orBfr, b_lettersOkOpt, ac_legal, bFALSE_IN_PRODUCTION)
public boolean hasDigitsOrInAOC(StringOrBuffer str_orBfr, boolean b_lettersOkOpt, char[] ac_legal, boolean b_validateAOC)
Does the string contain only digits and (other provided) legal characters?
isLegal(str_orBfr, b_lettersOkOpt, true, ac_legal, b_validateAOC)
public boolean hasLDOrInAOC(StringOrBuffer str_orBfr, char[] ac_legal)
Does the string contain only letters, digits and (other provided) legal characters?
hasLDOrInAOC(str_orBfr, ac_legal, bFALSE_IN_PRODUCTION)
public boolean hasLDOrInAOC(StringOrBuffer str_orBfr, char[] ac_legal, boolean b_validateAOC)
Does the string contain only letters, digits and (other provided) legal characters?
hasLDOrInAOC(str_orBfr, true, true, ac_legal, b_validateAOC)
public boolean hasLegalChars(StringOrBuffer str_orBfr, char[] ac_legal)
Does the string contain only legal characters?
hasLegalChars(str_orBfr, ac_legal, bFALSE_IN_PRODUCTION)
public boolean hasLegalChars(StringOrBuffer str_orBfr, char[] ac_legal, boolean b_validateAOC)
Does the string contain only legal characters?
isLegal(str_orBfr, false, false, ac_legal, b_validateAOC)
public boolean isLegal(StringOrBuffer str_orBfr, boolean b_lettersOkOpt, boolean b_digitsOkOpt, char[] ac_legal)
Does the string contain only legal characters?
isLegal(str_orBfr, b_lettersOkOpt, b_digitsOkOpt, ac_legal, bFALSE_IN_PRODUCTION)
public boolean isLegal(StringOrBuffer str_orBfr, boolean b_lettersOkOpt, boolean b_digitsOkOpt, char[] ac_legal, boolean b_validateAOC)
Does the string contain only legal characters?
UtilChar.isLegal(c, b_lettersOkOpt, b_digitsOkOpt, ac_legal, b_validateAOC)
to return true. b_validateAOC is only passed once. On the second and subsequent times, this parameter is set to false.
public boolean isNotLettersOrInAOC(StringOrBuffer str_orBfr, boolean b_digitsBadOpt, char[] ac_legal)
Does the string not contain any letters or (other provided) illegal characters?
isNotLettersOrInAOC(str_orBfr, b_digitsBadOpt, ac_legal, bFALSE_IN_PRODUCTION)
public boolean isNotLettersOrInAOC(StringOrBuffer str_orBfr, boolean b_digitsBadOpt, char[] ac_legal, boolean b_validateAOC)
Does the string not contain any letters or (other provided) illegal characters?
isNotIllegal(str_orBfr, true, b_digitsBadOpt, ac_legal, b_validateAOC)
public boolean isNotDigitsOrInAOC(StringOrBuffer str_orBfr, boolean b_lettersBadOpt, char[] ac_legal)
Does the string not contain any digits or (other provided) illegal characters?
isNotDigitsOrInAOC(str_orBfr, b_digitsBadOpt, ac_legal, bFALSE_IN_PRODUCTION)
public boolean isNotDigitsOrInAOC(StringOrBuffer str_orBfr, boolean b_lettersBadOpt, char[] ac_legal, boolean b_validateAOC)
Does the string not contain any digits or (other provided) illegal characters?
isNotIllegal(str_orBfr, b_lettersBadOpt, true, ac_legal, b_validateAOC)
public boolean isNotLDOrInAOC(StringOrBuffer str_orBfr, char[] ac_legal)
Does the string not contain any letters, digits or (other provided) illegal characters?
isNotLDOrInAOC(str_orBfr, ac_legal, bFALSE_IN_PRODUCTION)
public boolean isNotLDOrInAOC(StringOrBuffer str_orBfr, char[] ac_legal, boolean b_validateAOC)
Does the string not contain any letters, digits or (other provided) illegal characters?
isNotIllegal(str_orBfr, true, true, ac_legal, b_validateAOC)
public boolean hasNoIllegalChars(StringOrBuffer str_orBfr, char[] ac_illegal)
Does the string not contain any illegal characters?
hasNoIllegalChars(str_orBfr, ac_illegal, bFALSE_IN_PRODUCTION)
public boolean hasNoIllegalChars(StringOrBuffer str_orBfr, char[] ac_illegal, boolean b_validateAOC)
Does the string not contain any illegal characters?
isNotIllegal(str_orBfr, false, false, ac_illegal, b_validateAOC)
public boolean isNotIllegal(StringOrBuffer str_orBfr, boolean b_lettersBadOpt, boolean b_digitsBadOpt, char[] ac_illegal)
Does the string not contain any illegal characters?
isNotIllegal(str_orBfr, b_lettersBadOpt, b_digitsBadOpt, ac_illegal, bFALSE_IN_PRODUCTION)
public boolean isNotIllegal(StringOrBuffer str_orBfr, boolean b_lettersBadOpt, boolean b_digitsBadOpt, char[] ac_illegal, boolean b_validateAOC)
Does the string not contain any illegal characters?
UtilChar.isNotIllegal(c, b_lettersBadOpt, b_digitsBadOpt, ac_illegal, b_validateAOC)
to return true (in other words: If every character is not illegal/is legal). b_validateAOC is only passed once. On the second and subsequent times, this parameter is set to false.
public final SOBStringBuffer getReplaceAll(StringOrBuffer sob_searchIn, String s_searchFor, String s_replaceWith)
Return a copy of the provided StringOrBuffer (as an SOBStringBuffer), in which all occurances are replaced.
replaceAll(getSOBSB(sob_searchIn, "getReplaceAll"), s_searchFor, s_replaceWith)
public final int replaceAll(StringOrBuffer sob_searchIn, String s_searchFor, String s_replaceWith)
Replace all occurances. This function returns an int, representing the number of replacements made.
Say the contents of sob_searchIn equals "aaaaa", s_searchFor equals "aa" and s_replaceWith equals "a". The resulting contents of sob_searchIn will be "aaa". In sequence
Why this behavior? In order to prevent infinite loops. If the search were to resume at the same index (after a replacement), then replacing "a" with "aa" (duplicating, instead of removing duplicates) would never move beyond the index of the first instance of "a". It would just infinitely replace that first "a" with "aa", eventually causing an OutOfMemoryError.
The moral of the story: Run this multiple times in order to replace a superset with it's subset. Say "sLINE_SEP + sLINE_SEP
" with "sLINE_SEP
" (to eliminate all empty lines). Just keep replacing until this function returns zero.
sob_searchIn
- The string to search through and (potentially) do replacements in. May not be null.s_searchFor
- The string to search for, in sob_searchIn. May not be null or zero characters in length.s_replaceWith
- The string to replace all occurances of s_searchFor
with. May not be null or equal to s_searchFor
public final SOBStringBuffer getReplaceUntil(StringOrBuffer sob_searchIn, String s_searchFor, String s_replaceWith)
Replace all occurances, with multiple passes, until no instances of the search string remain.
replaceUntil((new SOBStringBuffer(sob_searchIn, sUSOB + "getReplaceUntil")), s_searchFor, s_replaceWith)
public final i_i replaceUntil(StringOrBuffer sob_searchIn, String s_searchFor, String s_replaceWith)
Replace all occurances, with multiple passes, until no instances of the search string remain.
This repeatedly calls replaceAll(sob_searchIn, s_searchFor, s_replaceWith)
until zero is returned. See replaceAll for parameter documentation.
public final SOBString getSOBS(StringOrBuffer str_orBfr, String s_callingFunc)
Create an SOBString from the StringOrBuffer.
getSOBS(str_orBfr, "str_orBfr", s_callingFunc)
public final SOBString getSOBS(StringOrBuffer str_orBfr, String s_description, String s_callingFunc)
Create an SOBString from the StringOrBuffer.
str_orBfr
- The StringOrBuffer to create an SOBString from. May not be null.s_sobDescription
- The descriptive name of str_orBfr, for potential error messages.s_callingFunc
- The function from which the potential error message should appear as if it is coming from.(new SOBString(str_orBfr.toString()))
public final SOBStringBuffer getSOBSB(StringOrBuffer str_orBfr, String s_callingFunc)
Create an SOBStringBuffer from the StringOrBuffer.
getSOBSB(str_orBfr, "str_orBfr", s_callingFunc)
public final SOBStringBuffer getSOBSB(StringOrBuffer str_orBfr, String s_description, String s_callingFunc)
Create an SOBString from the StringOrBuffer.
str_orBfr
- The StringOrBuffer to create an SOBStringBuffer from. May not be null.s_sobDescription
- The descriptive name of str_orBfr, for potential error messages.s_callingFunc
- The function from which the potential error message should appear as if it is coming from.(new SOBStringBuffer(str_orBfr.toString()))
public final void throwAXIfBadSOB(StringOrBuffer str_orBfr, String s_sobDescription, String s_callingFunc)
If the StringOrBuffer is null or empty (the string contained within is zero characters in length), then die. Otherwise do nothing.
str_orBfr
- The StringOrBuffer to analyze for null-ness and emptiness.s_sobDescription
- The descriptive name of str_orBfr, for potential error messages.s_callingFunc
- The function from which a potential error message should appear as if it is coming from.
|
|||||||||
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