xbn.string
Class UtilString

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.string.UtilSOB
              |
              +--xbn.string.UtilString

public class UtilString
extends UtilSOB

Random functions for java.lang.Strings. See String.

Source code:  UtilString.java.  Unit tests:  xbn_junit.string.JUTUtilString.java and also see the unit tests for UtilSOB..


Field Summary
static String sUS
          To shorten code and Javadoc.
 
Fields inherited from class xbn.string.UtilSOB
sUSOB
 
Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
UtilString()
          Create a UtilString.
 
Method Summary
 String[] getAOHexDigitAsStr(String s_tr)
           
 SOBString[] getAOSOBS(String[] a_string)
          Get an array of SOBStrings from the array of strings.
 SOBStringBuffer[] getAOSOBSB(String[] a_string)
          Get an array of SOBStringBuffers from the array of strings.
 boolean getBoolean(String s_potentialBoolean)
          Get a boolean from the value in the string.
 String getConditional(String s_value)
          Conditionally get the string, if it's not null.
 String getConditional(String s_value, String s_whenObjectNull)
          Conditionally get the string, if it's not null.
 String getConditional(String s_prefix, String s_value, String s_postfix)
          Convenience function to conditionally display a variable when non-null.
 String getConditional(String s_prefix, String s_value, String s_postfix, String s_whenValueNull)
          Convenience function to conditionally display a variable when non-null.
 String getConditional(String s_prefix, String s_value, String s_postfix, String s_whenValueNull, String s_whenValueEmpty)
          Get the string value (plus prefix and postfix) only when not-null.
 i_i_i getContainedIdxs(String[] a_string)
          If any string is contained in (or equal to) any other, get information describing the containment.
 i_i_i getContainedIdxs(String[] a_string, GCIConfig gci_config)
          If any string is contained in any other, get information describing the containment.
 i_i_i getContainedIdxs(String s_x, String s_y)
          If either string is contained in or equal to the other, get information describing the containment.
 i_i_i getContainedIdxs(String s_x, String s_y, GCICTwo gcic_two)
          If either string is contained in (or equal to) the other, get information describing the containment.
 Date getDate(String s_potentialDate, SimpleDateFormat simple_dateFormat)
          Get a Date object from the potential date string and SimpleDateFormat.
 Date getDate(String s_potentialDate, String s_dateFormat)
          Get a Date object from the potential date string and date format.
 String getDupAppend(String s_tr, String s_toDuplicate, int i_dupCount)
          Get a copy of the String, after appending a duplicated string onto it.
 String getDuped(String s_tr, int i_dupCount)
          Get the priovided string, duplicated.
 int getIdxNEToLmnt0(String[] a_string)
          What is the first array index containing an int not equal to element zero?
 int getIdxOf1stCharNIA(String s_tr, char[] a_char)
          Get the array index of the first character that is not a member of the array.
 int getIdxOf1stCharNIA(String s_tr, char[] a_char, boolean b_validateAOC)
          Get the array index of the first character that is not a member of the array.
 int getIdxOf1stCharNIA(String s_tr, char[] a_char, int i_idxStart, int i_idxAfterEnd)
          Get the array index of the first character that is not a member of the array.
 int getIdxOf1stCharNIA(String s_tr, char[] a_char, int i_idxStart, int i_idxAfterEnd, boolean b_validateAOC)
          Get the array index of the first character that does not exist in the array.
 int getIdxOf1stNonWS(String s_tr)
          Get the array index of the first non-white-space character.
 int getIdxOfLastCharNIA(String s_tr, char[] a_char)
          Get the array index of the last character that is not a member of the array.
 int getIdxOfLastCharNIA(String s_tr, char[] a_char, boolean b_validateAOC)
          Get the array index of the last character that is not a member of the array.
 int getIdxOfLastCharNIA(String s_tr, char[] a_char, int i_idxStart, int i_idxAfterEnd)
          Get the array index of the last character that is not a member of the array.
 int getIdxOfLastCharNIA(String s_tr, char[] a_char, int i_idxStart, int i_idxAfterEnd, boolean b_validateAOC)
          Get the array index of the last character that does not exist in the array.
 int getIdxOfLastNonWS(String s_tr)
          Get the array index of the last non-white-space character.
 int getInt(String s_potentialInt)
          Get an int from the value in the string.
 int getInt(String s_potentialInt, boolean b_nfxInsteadOfax)
          Get an int from the value in the string.
 long getLong(String s_potentialLong)
          Get an long from the value in the string.
 long getLong(String s_potentialLong, boolean b_nfxInsteadOfax)
          Get an long from the value in the string.
 String getQuotedLines(String s_tr)
          Get a copy of the String where each line is quoted.
 String getQuotedLines(String s_tr, String s_quote)
          Get a copy of the String where each line is quoted.
 String getQuotedLines(String s_tr, String s_quoteStart, String s_quoteEnd)
          Get a copy of the String where each line is quoted.
 String getQuotedLines(String s_tr, String s_quoteStart, String s_quoteEnd, String s_lineSep)
          Get a copy of the String where each line is quoted.
 String getRandomHex(int i_digits)
          Get a random hex number with the requested number of digits.
 String getReplaceAll(String s_tr, String s_replaceWhat, String s_replaceWith)
          Return a copy of the provided string, in which all occurances are replaced.
 String getReplaceUntil(String s_tr, String s_replaceWhat, String s_replaceWith)
          Replace all occurances, with multiple passes, until no instances of the search string remain.
 StringBuffer getSB(String s_tr)
          Create an SOBStringBuffer with the String.
 SOBString getSOBS(String s_tr, String s_callingClsFnc)
          Create an SOBString from the String.
 SOBString getSOBS(String s_tr, String s_sDescription, String s_callingClsFnc)
          Create an SOBString from the String.
 SOBStringBuffer getSOBSB(String s_tr, String s_callingClsFnc)
          Create an SOBStringBuffer from the String.
 SOBStringBuffer getSOBSB(String s_tr, String s_sDescription, String s_callingClsFnc)
          Create an SOBStringBuffer from the String.
 String getVisible(String s_tr)
          Get a copy of the String, where the contents' invisible characters are made visible.
 boolean hasDigitsOrInAOC(String s_tr, boolean b_lettersOkOpt, char[] ac_legal)
          Does the string contain only digits and (other provided) legal characters?
 boolean hasDigitsOrInAOC(String s_tr, boolean b_lettersOkOpt, char[] ac_legal, boolean b_validateAOC)
          Does the string contain only digits and (other provided) legal characters?
 boolean hasLDOrInAOC(String s_tr, char[] ac_legal)
          Does the string contain only letters, digits and (other provided) legal characters?
 boolean hasLDOrInAOC(String s_tr, char[] ac_legal, boolean b_validateAOC)
          Does the string contain only letters, digits and (other provided) legal characters?
 boolean hasLegalChars(String s_tr, char[] ac_legal)
          Does the string contain only legal characters?
 boolean hasLegalChars(String s_tr, char[] ac_legal, boolean b_validateAOC)
          Does the string contain only legal characters?
 boolean hasLettersOrInAOC(String s_tr, boolean b_digitsOkOpt, char[] ac_legal)
          Does the string contain only letters and (other provided) legal characters?
 boolean hasLettersOrInAOC(String s_tr, boolean b_digitsOkOpt, char[] ac_legal, boolean b_validateAOC)
          Does the string contain only letters and (other provided) legal characters?
 boolean hasNoIllegalChars(String s_tr, char[] ac_illegal)
          Does the string not contain any illegal characters?
 boolean hasNoIllegalChars(String s_tr, char[] ac_illegal, boolean b_validateAOC)
          Does the string not contain any illegal characters?
 boolean hasNoTabSpace(String s_tr)
          Does the String not contain any whitespace characters?
 boolean isBoolean(String s_potentialBoolean)
          Does the string contain a valid boolean value?.
 boolean isDecimal(String s_potentialDigit)
          Is the string a valid decimal number?.
 boolean isEmail(String s_potentialEmail)
          Is the string a legally formatted email address?
 boolean isHexidecimal(String s_potentialHex)
          Is the value of the String a valid hexidecimal number?
 boolean isInteger(String s_potentialInteger)
          Is the string a valid integer?.
 boolean isLegal(String s_tr, boolean b_lettersOkOpt, boolean b_digitsOkOpt, char[] ac_legal)
          Does the string contain only legal characters?
 boolean isLegal(String s_tr, boolean b_lettersOkOpt, boolean b_digitsOkOpt, char[] ac_legal, boolean b_validateAOC)
          Does the string contain only legal characters?
 boolean isLetterDigitUnderscore(String s_tr)
          Does the string contain only letters, digits and underscores?
 boolean isNotDigitsOrInAOC(String s_tr, boolean b_lettersBadOpt, char[] ac_legal)
          Does the string not contain any digits or (other provided) illegal characters?
 boolean isNotDigitsOrInAOC(String s_tr, boolean b_lettersBadOpt, char[] ac_legal, boolean b_validateAOC)
          Does the string not contain any digits or (other provided) illegal characters?
 boolean isNotIllegal(String s_tr, boolean b_lettersBadOpt, boolean b_digitsBadOpt, char[] ac_illegal)
          Does the string not contain any illegal characters?
 boolean isNotIllegal(String s_tr, boolean b_lettersBadOpt, boolean b_digitsBadOpt, char[] ac_illegal, boolean b_validateAOC)
          Does the string not contain any illegal characters?
 boolean isNotLDOrInAOC(String s_tr, char[] ac_legal)
          Does the string not contain any letters, digits or (other provided) illegal characters?
 boolean isNotLDOrInAOC(String s_tr, char[] ac_legal, boolean b_validateAOC)
          Does the string not contain any letters, digits or (other provided) illegal characters?
 boolean isNotLettersOrInAOC(String s_tr, boolean b_digitsBadOpt, char[] ac_legal)
          Does the string not contain any letters or (other provided) illegal characters?
 boolean isNotLettersOrInAOC(String s_tr, boolean b_digitsBadOpt, char[] ac_legal, boolean b_validateAOC)
          Does the string not contain any letters or (other provided) illegal characters?
 boolean isNumber(String s_potentialDigit, boolean b_decimalAllowed)
          Is the string a valid digit?
 boolean isTabSpace(String s_potentialTabSpace)
          Does the String contain only whitespace?
 
Methods inherited from class xbn.string.UtilSOB
dupAppend, getContainedIdxs, getContainedIdxs, getContainedIdxs, getContainedIdxs, getDupAppend, getGSAInfo, getIdxOf1stCharNIA, getIdxOf1stCharNIA, getIdxOf1stCharNIA, getIdxOf1stCharNIA, getIdxOf1stNonWS, getIdxOfLastCharNIA, getIdxOfLastCharNIA, getIdxOfLastCharNIA, getIdxOfLastCharNIA, getIdxOfLastNonWS, getQuotedLines, getQuotedLines, getQuotedLines, getQuotedLines, getReplaceAll, getReplaceUntil, getSOBS, getSOBS, getSOBSB, getSOBSB, getStringAround, getVisible, hasDigitsOrInAOC, hasDigitsOrInAOC, hasLDOrInAOC, hasLDOrInAOC, hasLegalChars, hasLegalChars, hasLettersOrInAOC, hasLettersOrInAOC, hasNoIllegalChars, hasNoIllegalChars, hasNoTabSpace, indexOfWord, indexOfWord, isHexidecimal, isLegal, isLegal, isLetterDigitUnderscore, isNotDigitsOrInAOC, isNotDigitsOrInAOC, isNotIllegal, isNotIllegal, isNotLDOrInAOC, isNotLDOrInAOC, isNotLettersOrInAOC, isNotLettersOrInAOC, isTabSpace, lastIndexOfWord, lastIndexOfWord, makeVisible, quoteLines, quoteLines, quoteLines, quoteLines, replaceAll, replaceUntil, throwAXIfBadSOB
 
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

sUS

public static final String sUS

To shorten code and Javadoc.

Equal to "xbn.string.UtilString."

Constructor Detail

UtilString

public UtilString()

Create a UtilString. This constructor does nothing.

Method Detail

getAOHexDigitAsStr

public final String[] getAOHexDigitAsStr(String s_tr)

getRandomHex

public String getRandomHex(int i_digits)

Get a random hex number with the requested number of digits.

Parameters:
i_digits - The number of digits in length the returned value should be. Must be greater than -1.
Returns:
"" If i_digits is zero.
[A hex digit of i_digits length] If i_digits is anything but zero.

getConditional

public String getConditional(String s_value)

Conditionally get the string, if it's not null.

Equal to getConditional(s_value, "")


getConditional

public String getConditional(String s_value,
                             String s_whenObjectNull)

Conditionally get the string, if it's not null.

Equal to getConditional(null, s_value, null, s_whenObjectNull)


getConditional

public String getConditional(String s_prefix,
                             String s_value,
                             String s_postfix)

Convenience function to conditionally display a variable when non-null.

Equal to getConditional(s_prefix, s_value, s_postfix, "")


getConditional

public String getConditional(String s_prefix,
                             String s_value,
                             String s_postfix,
                             String s_whenValueNull)

Convenience function to conditionally display a variable when non-null.

Equal to getConditional(s_prefix, s_value, s_postfix, s_whenValueNull, "")


getConditional

public String getConditional(String s_prefix,
                             String s_value,
                             String s_postfix,
                             String s_whenValueNull,
                             String s_whenValueEmpty)

Get the string value (plus prefix and postfix) only when not-null. When null, get the alternative ("when-null") value.

Parameters:
s_prefix - The string to put before the non-null value. When null, no prefix is used (which is the same behavior as when this is equal to empty string).
s_value - The value. When null, all parameters except s_whenValueNull are ignored. When not null, (only) s_whenValueNull is ignored.
s_prefix - The string to put after the non-null value. When null, no postfix is used (which is the same behavior as when this is equal to empty string).
s_whenValueNull - When s_value is null, then this is the entire text that is returned (no prefix or postfix). When s_value is not null, this parameter is ignored. May be null or any number of characters in length. To emphasize, if both an s_value are null, then 'null' is returned.
s_whenValueEmpty - When s_value is zero characters in length, then this is the entire text that is returned (no prefix or postfix). When s_value is not empty, this parameter is ignored. May be null or any number of characters in length. This behaves in the same manner as s_whenValueNull, when s_value is empty.
Returns:
s_whenValueNull If s_value is null.
s_prefix + s_value + s_postfix If s_value is not null. Note that if s_prefix is null, it is omitted. If s_postfix is null, it is omitted.

getBoolean

public boolean getBoolean(String s_potentialBoolean)

Get a boolean from the value in the string.

Parameters:
s_potentialBoolean - The string containing a boolean value.
Returns:
true If s_potentialBoolean equals "true" (case sensitive).
false If s_potentialBoolean equals "false" (case sensitive).
Throws:
AssertException - If s_potentialBoolean is null, or contains a value other than "true" or "false".

getInt

public int getInt(String s_potentialInt)

Get an int from the value in the string.

Equal to getInt(s_potentialInt, false)


getInt

public int getInt(String s_potentialInt,
                  boolean b_nfxInsteadOfax)

Get an int from the value in the string.

TODO: A critical difference between this and isNumber: This function uses Integer.valueOf, and therefore a huge number (like 8374018734087120847104387208472784) is considered invalid according to this function, but valid according to isNumber (would return true).

Parameters:
s_potentialInt - The string containing an int value.
b_nfxInsteadOfax - If the s_potentialInt is null, or contains an illegal value, according to Integer.valueOf(s_potentialInt).intValue()

getLong

public long getLong(String s_potentialLong)

Get an long from the value in the string.

Equal to getLong(s_potentialLong, false)


getLong

public long getLong(String s_potentialLong,
                    boolean b_nfxInsteadOfax)

Get an long from the value in the string.

Parameters:
s_potentialLong - The string containing an long value.
b_nfxInsteadOfax - If the s_potentialLong is null, or contains an illegal value, according to Long.valueOf(s_potentialLong).longValue()

getDate

public Date getDate(String s_potentialDate,
                    String s_dateFormat)

Get a Date object from the potential date string and date format.

Returns:
getDate(s_potentialDate, new SimpleDateFormat(s_dateFormat))

getDate

public Date getDate(String s_potentialDate,
                    SimpleDateFormat simple_dateFormat)

Get a Date object from the potential date string and SimpleDateFormat.

Parameters:
s_potentialDate - String containing a date that conforms to s_dateFormat. May not be null.
simple_dateFormat - The SimpleDateFormat that s_potentialDate must conform to. May not be null.
Returns:
simple_dateFormat.parse(s_potentialDate)

isEmail

public boolean isEmail(String s_potentialEmail)

Is the string a legally formatted email address?

Parameters:
s_potentialEmail - The string to analyze.
Returns:
false If any of the following conditions are met:
  • s_potentialEmail is null or zero characters in length.
  • There are zero @.
  • There are more than one @.
  • @ is the first or last character.
  • . is the first or last character.
  • There is one or more spaces (" "), commas (","), escape slashes ("\\"), or slashes ("/")
  • Contains a period immediately followed by an @, or vice-versa.
  • Contains two periods in a row.
  • The last period is found before the @.

true If otherwise.

isBoolean

public boolean isBoolean(String s_potentialBoolean)

Does the string contain a valid boolean value?. Note that the behavior of this function is distinct from java.lang.Boolean.valueOf.

Parameters:
s_potentialBoolean - The string to analyze.
Returns:
true If s_potentialBoolean equals "true" or "false".
false If s_potentialBoolean is null, or does not equal "true" or "false".

isInteger

public boolean isInteger(String s_potentialInteger)

Is the string a valid integer?. An integer is a number without a decimal point.

Equal to isNumber(s_potentialDigit, false)


isDecimal

public boolean isDecimal(String s_potentialDigit)

Is the string a valid decimal number?. A decimal number may or may not have a decimal point.

Equal to isNumber(s_potentialDigit, true)


isNumber

public boolean isNumber(String s_potentialDigit,
                        boolean b_decimalAllowed)

Is the string a valid digit?

A digit is defined with the following rules:

TODO: A critical difference between this and getInt: This function does string analysis, and therefore a huge number (8374018734087120847104387208472784) is considered valid according to this function, while invalid according to getInt (would throw an exception)

Parameters:
s_potentialDigit - The string to analyze.
b_decimalAllowed - If true, then the digit is allowed to have (exactly one) decimal point. If false, the digit is not allowed to have a decimal point, and therefore must be an integer.
Returns:
true If the string conforms to the rules.
false If the string breaks any of the rules.

getContainedIdxs

public final i_i_i getContainedIdxs(String s_x,
                                    String s_y)

If either string is contained in or equal to the other, get information describing the containment.

Returns:
getContainedIdx(getSOBS(s_x, "getContainedIdx"), getSOBS(s_y, "getContainedIdx"))

getContainedIdxs

public final i_i_i getContainedIdxs(String s_x,
                                    String s_y,
                                    GCICTwo gcic_two)

If either string is contained in (or equal to) the other, get information describing the containment.

Returns:
getContainedIdx(getSOBS(s_x, "getContainedIdx"), getSOBS(s_y, "getContainedIdx"), gcic_two)

The array is created only once, and populated in this function repeatedly.


getContainedIdxs

public final i_i_i getContainedIdxs(String[] a_string)

If any string is contained in (or equal to) any other, get information describing the containment.

Equal to getContainedIdxs(getAOSOBS(a_string), (new GCIConfig()))


getContainedIdxs

public final i_i_i getContainedIdxs(String[] a_string,
                                    GCIConfig gci_config)

If any string is contained in any other, get information describing the containment.

Equal to getContainedIdxs(getAOSOBS(a_string), (new GCIConfig()))


getQuotedLines

public final String getQuotedLines(String s_tr)

Get a copy of the String where each line is quoted.

Returns:
getQuotedLines(getSOBSB(s_tr, sUS + "getQuotedLines")).toString()

getQuotedLines

public final String getQuotedLines(String s_tr,
                                   String s_quote)

Get a copy of the String where each line is quoted.

Returns:
getQuotedLines(getSOBSB(s_tr, sUS + "getQuotedLines"), s_quote).toString()

getQuotedLines

public final String getQuotedLines(String s_tr,
                                   String s_quoteStart,
                                   String s_quoteEnd)

Get a copy of the String where each line is quoted.

Returns:
getQuotedLines(getSOBSB(s_tr, sUS + "getQuotedLines"), s_quoteStart, s_quoteEnd).toString()

getQuotedLines

public final String getQuotedLines(String s_tr,
                                   String s_quoteStart,
                                   String s_quoteEnd,
                                   String s_lineSep)

Get a copy of the String where each line is quoted.

Returns:
getQuotedLines(getSOBSB(s_tr, sUS + "getQuotedLines"), s_quoteStart, s_quoteEnd, s_lineSep).toString()

isHexidecimal

public boolean isHexidecimal(String s_potentialHex)

Is the value of the String a valid hexidecimal number?

Returns:
isHexidecimal(getSOBS(s_potentialHex, "s_potentialHex", sUS + ".isHexidecimal"))

isTabSpace

public boolean isTabSpace(String s_potentialTabSpace)

Does the String contain only whitespace?

Parameters:
s_potentialTabSpace - The String analyzed, to see if it contains only whitespace characters. May not be null or zero characters in length.
Returns:
isTabSpace(getSOBS(s_potentialTabSpace, "s_potentialTabSpace", sUS + ".isTabSpace"))


hasNoTabSpace

public boolean hasNoTabSpace(String s_tr)

Does the String not contain any whitespace characters?

Parameters:
s_tr - The String analyzed, to see if it contains only non-whitespace characters. May not be null or zero characters in length.
Returns:
hasNoTabSpace(getSOBS(s_tr, sUS + ".hasNoTabSpace"))


getDupAppend

public final String getDupAppend(String s_tr,
                                 String s_toDuplicate,
                                 int i_dupCount)

Get a copy of the String, after appending a duplicated string onto it.

Returns:
dupAppend(getSOBSB(s_tr, sUS + ".getDupAppend"), s_toDuplicate, i_dupCount).toString()

getDuped

public String getDuped(String s_tr,
                       int i_dupCount)

Get the priovided string, duplicated.

Returns:
getDupAppend("", s_tr, i_dupCount)

getIdxOf1stNonWS

public final int getIdxOf1stNonWS(String s_tr)

Get the array index of the first non-white-space character.

Returns:
getIdxOf1stNonWS(getSOBS(s_tr, sUS + ".getIdxOf1stNonWS"))


getIdxOfLastNonWS

public final int getIdxOfLastNonWS(String s_tr)

Get the array index of the last non-white-space character.

Returns:
getIdxOfLastNonWS(getSOBS(s_tr, sUS + ".getIdxOfLastNonWS"))

getIdxOf1stCharNIA

public final int getIdxOf1stCharNIA(String s_tr,
                                    char[] a_char)

Get the array index of the first character that is not a member of the array.

Returns:
getIdxOf1stCharNIA(getSOBS(s_tr, sUS + "getIdxOf1stCharNIA"), a_char)

getIdxOf1stCharNIA

public final int getIdxOf1stCharNIA(String s_tr,
                                    char[] a_char,
                                    boolean b_validateAOC)

Get the array index of the first character that is not a member of the array.

Returns:
getIdxOf1stCharNIA(getSOBS(s_tr, sUS + "getIdxOf1stCharNIA"), a_char, 0, s_tr.length(), b_validateAOC)

getIdxOf1stCharNIA

public final int getIdxOf1stCharNIA(String s_tr,
                                    char[] a_char,
                                    int i_idxStart,
                                    int i_idxAfterEnd)

Get the array index of the first character that is not a member of the array.

Returns:
getIdxOf1stCharNIA(getSOBS(s_tr, sUS + "getIdxOf1stCharNIA"), a_char, i_idxStart, i_idxAfterEnd)

getIdxOf1stCharNIA

public final int getIdxOf1stCharNIA(String s_tr,
                                    char[] a_char,
                                    int i_idxStart,
                                    int i_idxAfterEnd,
                                    boolean b_validateAOC)

Get the array index of the first character that does not exist in the array.

Returns:
getIdxOf1stCharNIA(getSOBS(s_tr, sUS + "getIdxOf1stCharNIA"), a_char, i_idxStart, i_idxAfterEnd, b_validateAOC)

getIdxOfLastCharNIA

public final int getIdxOfLastCharNIA(String s_tr,
                                     char[] a_char)

Get the array index of the last character that is not a member of the array.

Returns:
getIdxOfLastCharNIA(getSOBS(s_tr, sUS + "getIdxOfLastCharNIA"), a_char)

getIdxOfLastCharNIA

public final int getIdxOfLastCharNIA(String s_tr,
                                     char[] a_char,
                                     boolean b_validateAOC)

Get the array index of the last character that is not a member of the array.

Returns:
getIdxOfLastCharNIA(getSOBS(s_tr, sUS + "getIdxOfLastCharNIA"), a_char, 0, length(), b_validateAOC)

getIdxOfLastCharNIA

public final int getIdxOfLastCharNIA(String s_tr,
                                     char[] a_char,
                                     int i_idxStart,
                                     int i_idxAfterEnd)

Get the array index of the last character that is not a member of the array.

Returns:
getIdxOfLastCharNIA(getSOBS(s_tr, sUS + "getIdxOfLastCharNIA"), a_char, i_idxStart, i_idxAfterEnd)

getIdxOfLastCharNIA

public final int getIdxOfLastCharNIA(String s_tr,
                                     char[] a_char,
                                     int i_idxStart,
                                     int i_idxAfterEnd,
                                     boolean b_validateAOC)

Get the array index of the last character that does not exist in the array.

Returns:
getIdxOfLastCharNIA(getSOBS(s_tr, sUS + "getIdxOfLastCharNIA"), a_char, i_idxStart, i_idxAfterEnd, b_validateAOC)

getVisible

public final String getVisible(String s_tr)

Get a copy of the String, where the contents' invisible characters are made visible.

Returns:
getVisible(getSOBSB(s_tr, sUS + ".getVisible").toString()

isLetterDigitUnderscore

public boolean isLetterDigitUnderscore(String s_tr)

Does the string contain only letters, digits and underscores?

Returns:
isLetterDigitUnderscore(getSOBS(s_tr, sUS + ".isLetterDigitUnderscore"))

hasLettersOrInAOC

public boolean hasLettersOrInAOC(String s_tr,
                                 boolean b_digitsOkOpt,
                                 char[] ac_legal)

Does the string contain only letters and (other provided) legal characters?

Returns:
hasLettersOrInAOC(getSOBS(s_tr, sUS + ".hasLettersOrInAOC"), b_digitsOkOpt, ac_legal)

hasLettersOrInAOC

public boolean hasLettersOrInAOC(String s_tr,
                                 boolean b_digitsOkOpt,
                                 char[] ac_legal,
                                 boolean b_validateAOC)

Does the string contain only letters and (other provided) legal characters?

Returns:
hasLettersOrInAOC(getSOBS(s_tr, sUS + ".hasLettersOrInAOC"), b_digitsOkOpt, ac_legal, b_validateAOC)

hasDigitsOrInAOC

public boolean hasDigitsOrInAOC(String s_tr,
                                boolean b_lettersOkOpt,
                                char[] ac_legal)

Does the string contain only digits and (other provided) legal characters?

Returns:
hasDigitsOrInAOC(getSOBS(s_tr, sUS + ".hasDigitsOrInAOC"), b_lettersOkOpt, ac_legal)

hasDigitsOrInAOC

public boolean hasDigitsOrInAOC(String s_tr,
                                boolean b_lettersOkOpt,
                                char[] ac_legal,
                                boolean b_validateAOC)

Does the string contain only digits and (other provided) legal characters?

Returns:
hasDigitsOrInAOC(getSOBS(s_tr, sUS + ".hasDigitsOrInAOC"), b_lettersOkOpt, ac_legal, b_validateAOC)

hasLDOrInAOC

public boolean hasLDOrInAOC(String s_tr,
                            char[] ac_legal)

Does the string contain only letters, digits and (other provided) legal characters?

Returns:
hasLDOrInAOC(getSOBS(s_tr, sUS + ".hasLDOrInAOC"), ac_legal)

hasLDOrInAOC

public boolean hasLDOrInAOC(String s_tr,
                            char[] ac_legal,
                            boolean b_validateAOC)

Does the string contain only letters, digits and (other provided) legal characters?

Returns:
hasLDOrInAOC(getSOBS(s_tr, sUS + ".hasLDOrInAOC"), ac_legal, b_validateAOC)

hasLegalChars

public boolean hasLegalChars(String s_tr,
                             char[] ac_legal)

Does the string contain only legal characters?

Returns:
hasLegalChars(getSOBS(s_tr, sUS + ".hasLegalChars"), ac_legal)

hasLegalChars

public boolean hasLegalChars(String s_tr,
                             char[] ac_legal,
                             boolean b_validateAOC)

Does the string contain only legal characters?

Returns:
isLegal(getSOBS(s_tr, sUS + ".hasLegalChars"), false, false, ac_legal, b_validateAOC)

isLegal

public boolean isLegal(String s_tr,
                       boolean b_lettersOkOpt,
                       boolean b_digitsOkOpt,
                       char[] ac_legal)

Does the string contain only legal characters?

Returns:
isLegal(getSOBS(s_tr, sUS + ".isLegal"), b_lettersOkOpt, b_digitsOkOpt, ac_legal)

isLegal

public boolean isLegal(String s_tr,
                       boolean b_lettersOkOpt,
                       boolean b_digitsOkOpt,
                       char[] ac_legal,
                       boolean b_validateAOC)

Does the string contain only legal characters?

Returns:
isLegal(getSOBS(s_tr, sUS + ".isLegal"), b_lettersOkOpt, b_digitsOkOpt, ac_legal, b_validateAOC)

isNotLettersOrInAOC

public boolean isNotLettersOrInAOC(String s_tr,
                                   boolean b_digitsBadOpt,
                                   char[] ac_legal)

Does the string not contain any letters or (other provided) illegal characters?

Returns:
isNotLettersOrInAOC(getSOBS(s_tr, sUS + ".isNotLettersOrInAOC"), b_digitsBadOpt, ac_legal)

isNotLettersOrInAOC

public boolean isNotLettersOrInAOC(String s_tr,
                                   boolean b_digitsBadOpt,
                                   char[] ac_legal,
                                   boolean b_validateAOC)

Does the string not contain any letters or (other provided) illegal characters?

Returns:
isNotLettersOrInAOC(getSOBS(s_tr, sUS + ".isNotLettersOrInAOC"), b_digitsBadOpt, ac_legal, b_validateAOC)

isNotDigitsOrInAOC

public boolean isNotDigitsOrInAOC(String s_tr,
                                  boolean b_lettersBadOpt,
                                  char[] ac_legal)

Does the string not contain any digits or (other provided) illegal characters?

Returns:
isNotDigitsOrInAOC(getSOBS(s_tr, sUS + ".isNotDigitsOrInAOC"), b_digitsBadOpt, ac_legal)

isNotDigitsOrInAOC

public boolean isNotDigitsOrInAOC(String s_tr,
                                  boolean b_lettersBadOpt,
                                  char[] ac_legal,
                                  boolean b_validateAOC)

Does the string not contain any digits or (other provided) illegal characters?

Returns:
isNotDigitsOrInAOC(getSOBS(s_tr, sUS + ".isNotDigitsOrInAOC"), b_lettersBadOpt, ac_legal, b_validateAOC)

isNotLDOrInAOC

public boolean isNotLDOrInAOC(String s_tr,
                              char[] ac_legal)

Does the string not contain any letters, digits or (other provided) illegal characters?

Returns:
isNotLDOrInAOC(getSOBS(s_tr, sUS + ".isNotLDOrInAOC"), ac_legal)

isNotLDOrInAOC

public boolean isNotLDOrInAOC(String s_tr,
                              char[] ac_legal,
                              boolean b_validateAOC)

Does the string not contain any letters, digits or (other provided) illegal characters?

Returns:
isNotLDOrInAOC(getSOBS(s_tr, sUS + ".isNotLDOrInAOC"), ac_legal, b_validateAOC)

hasNoIllegalChars

public boolean hasNoIllegalChars(String s_tr,
                                 char[] ac_illegal)

Does the string not contain any illegal characters?

Returns:
hasNoIllegalChars(getSOBS(s_tr, sUS + ".hasNoIllegalChars"), ac_illegal)

hasNoIllegalChars

public boolean hasNoIllegalChars(String s_tr,
                                 char[] ac_illegal,
                                 boolean b_validateAOC)

Does the string not contain any illegal characters?

Returns:
isNotIllegal(getSOBS(s_tr, sUS + ".hasNoIllegalChars"), false, false, ac_illegal, b_validateAOC)

isNotIllegal

public boolean isNotIllegal(String s_tr,
                            boolean b_lettersBadOpt,
                            boolean b_digitsBadOpt,
                            char[] ac_illegal)

Does the string not contain any illegal characters?

Returns:
isNotIllegal(getSOBS(s_tr, sUS + ".isNotIllegal"), b_lettersBadOpt, b_digitsBadOpt, ac_illegal)

isNotIllegal

public boolean isNotIllegal(String s_tr,
                            boolean b_lettersBadOpt,
                            boolean b_digitsBadOpt,
                            char[] ac_illegal,
                            boolean b_validateAOC)

Does the string not contain any illegal characters?

Returns:
isNotIllegal(getSOBS(s_tr, sUS + ".isNotLegal"), b_lettersBadOpt, b_digitsBadOpt, ac_illegal, b_validateAOC)

getSB

public StringBuffer getSB(String s_tr)

Create an SOBStringBuffer with the String.

Returns:
null If s_tr is null.
(new StringBuffer(s_tr)) If s_tr is non-null.

getReplaceAll

public final String getReplaceAll(String s_tr,
                                  String s_replaceWhat,
                                  String s_replaceWith)

Return a copy of the provided string, in which all occurances are replaced.

Returns:
getReplaceAll(getSOBSB(s_tr, sUS + ".getReplaceAll"), s_replaceWhat, s_replaceWith)

getReplaceUntil

public final String getReplaceUntil(String s_tr,
                                    String s_replaceWhat,
                                    String s_replaceWith)

Replace all occurances, with multiple passes, until no instances of the search string remain.

Returns:
getReplaceUntil(getSOBSB(s_tr, sUS + ".getReplaceUntil"), s_replaceWhat, s_replaceWith)

getIdxNEToLmnt0

public final int getIdxNEToLmnt0(String[] a_string)

What is the first array index containing an int not equal to element zero?

This is useful in unit tests that tests multiple versions of the same function, when you want to ensure that each returns the same value.

Parameters:
a_int - The int array to analyze. May not be null or equal to zero elements in length. Element zero may not be null.
Returns:
-1 If a_int.length is one element in length, or every element in the array is equal.
The array index representing the first element in a_int whose value is different than element zero. Will definitely be greater than zero.

getSOBS

public final SOBString getSOBS(String s_tr,
                               String s_callingClsFnc)

Create an SOBString from the String.

Returns:
getSOBS(s_tr, sUS + ".s_tr", s_callingClsFnc)

getSOBS

public final SOBString getSOBS(String s_tr,
                               String s_sDescription,
                               String s_callingClsFnc)

Create an SOBString from the String.

Parameters:
s_tr - The String to create a new SOBString with. May not be null.
s_sDescription - The descriptive name of s_tr, for potential error messages.
s_callingClsFnc - The function from which the potential error message should appear as if it is coming from.
Returns:
(new SOBString(s_tr))

getSOBSB

public final SOBStringBuffer getSOBSB(String s_tr,
                                      String s_callingClsFnc)

Create an SOBStringBuffer from the String.

Returns:
getSOBSB(s_tr, "s_tr", s_callingClsFnc)

getSOBSB

public final SOBStringBuffer getSOBSB(String s_tr,
                                      String s_sDescription,
                                      String s_callingClsFnc)

Create an SOBStringBuffer from the String.

Parameters:
s_tr - The String to create a new SOBStringBuffer with. May not be null.
s_sDescription - The descriptive name of s_tr, for potential error messages.
s_callingClsFnc - The function from which the potential error message should appear as if it is coming from.
Returns:
(new SOBStringBuffer(s_tr))

getAOSOBS

public final SOBString[] getAOSOBS(String[] a_string)

Get an array of SOBStrings from the array of strings.

Parameters:
a_string - The array of strings to create an array of SOBStrings from.
Returns:
null If a_string is null.
An array of SOBStrings where each element has contents equalling that in the corresponding member of a_string. Note: If a_string[X] is null then the X-th element in the returned array is also null (it is not possible to have the contents of an SOBString equal null).

getAOSOBSB

public final SOBStringBuffer[] getAOSOBSB(String[] a_string)

Get an array of SOBStringBuffers from the array of strings.

Parameters:
a_string - The array of strings to create an array of SOBStringBuffers from.
Returns:
null If a_string is null.
An array of SOBStringBuffers where each element has contents equalling that in the corresponding member of a_string. Note: If a_string[X] is null then the X-th element in the returned array is also null (it is not possible to have the contents of an SOBStringBuffer equal null).



Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo