Package Torello.Java
Class StrCmpr
- java.lang.Object
-
- Torello.Java.StrCmpr
-
public class StrCmpr extends java.lang.Object
Class String-Compare provides an exhaustive-combinatoric suite of methods that extend the basic JavaString
methodsequals, contains, startsWith
andendsWith
.
This class offers an API that has a large collection of comparison routines for ajava.lang.String
.
Obviously, Regular-Expressions will always be capable of providing the most powerful String-Search and manipulations routines. However, with the extra level of control that a Regular-Expression offers comes some extra-amount of complexity. The routines inclass StrCmpr
andclass StrIndexOf
can eliminatefor-loops
and all the debugging that comes along with them - saving programmers countless hours of when their programs need only simple comparisons and searches that can be written without a RegEx.
The methods in this class usesubstring
comparison-logic, rather thantoken
compares - meaning that the loops are checking only the characters within input parameter(s)comparStr
. The characters before and after a match are ignored.
Example:
boolean result = StrCmpr.containsXOR_CI("Visited in August of this year." "july", "august"); // Evaluates to TRUE boolean result = StrCmpr.containsXOR_CI("Traveled to Beijing last year.", "july", "august"); // Evaluates to FALSE
Methods Available
Method-Name Key-Word Explanation NAND May not find any matches between the primary String srcStr
parameter, and theString's
passed to'compareStr'
NAND-NOTE: There is one very important subtlety about the meaning of'NAND'
here. In this case, the methods that use'NAND'
interpret its meaning as "NOT ANY ONE OF..." - meaning all comparisons must fail.XOR Must find precisely one match between the primary String srcStr
parameter, and theString's
in'compareStr'
.
There is one 'philosophical note' which is that if multiple copies of an identical-String
are passed via the comparison-String
array (String... comparestr
), all XOR methods shall not pay heed to the notion that they the'srcStr'
parmeter may have only started-with, ended-with or contained a singleString
(and 'philosophically passing' the XOR, one-and-only-one test). The internal-logical is 'programmatically ignorant' of this - multiple copies of an identical-String
(or identical, ignoring-case) could theoretically be flagged via throwing anIllegalArgumentException
. However, no such check is performed.OR Must find at least one match between the primary String srcStr
parameter, and theString's
in the'compareStr'
parameter.AND Must identify a containing-match between each and every String
inString... compareStr
and the primary'srcStr'
parameter.Starts With The provided compare-String
(orString's
) must match the beginning of parameter'srcStr'
.Ends With The provided compare-String
(orString's
) must match the ending of parameter'srcStr'
.Contains The provided compare-String
(orString's
) must be a substring of parameter'srcStr'
.CI (Case Insensitive) All equality-tests will be done on a Case Insensitive
basis.
Hi-Lited Source-Code:- View Here: Torello/Java/StrCmpr.java
- Open New Browser-Tab: Torello/Java/StrCmpr.java
File Size: 72,626 Bytes Line Count: 1,405 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctional
Annotation may also be called 'The Spaghetti Report'.Static-Functional
classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@Stateless
Annotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 66 Method(s), 66 declared static
- 7 Field(s), 7 declared static, 5 declared final
- Fields excused from final modifier (with explanation):
Field 'DEBUG' is not final. Reason: DEBUGGING Field 'DEBUG_LOG' is not final. Reason: DEBUGGING
-
-
Method Summary
Equals Modifier and Type Method static boolean
equalsNAND(String srcStr, String... compareStr)
static boolean
equalsNAND_CI(String srcStr, String... compareStr)
static boolean
equalsXOR(String srcStr, String... compareStr)
static boolean
equalsXOR_CI(String srcStr, String... compareStr)
Equals, Range-Limited Modifier and Type Method static boolean
equals(String srcStr, int sPos, int ePos, String compareStr)
static boolean
equalsIgnoreCase(String srcStr, int sPos, int ePos, String compareStr)
static boolean
equalsNAND(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
equalsNAND_CI(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
equalsXOR(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
equalsXOR_CI(String srcStr, int sPos, int ePos, String... compareStr)
Contains Modifier and Type Method static boolean
containsAND(String srcStr, String... compareStr)
static boolean
containsAND_CI(String srcStr, String... compareStr)
static boolean
containsIgnoreCase(String srcStr, String compareStr)
static boolean
containsNAND(String srcStr, String... compareStr)
static boolean
containsNAND_CI(String srcStr, String... compareStr)
static boolean
containsOR(String srcStr, String... compareStr)
static boolean
containsOR_CI(String srcStr, String... compareStr)
static boolean
containsXOR(String srcStr, String... compareStr)
static boolean
containsXOR_CI(String srcStr, String... compareStr)
Contains, Range-Limited Modifier and Type Method static boolean
contains(String srcStr, int sPos, int ePos, String compareStr)
static boolean
containsAND(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
containsAND_CI(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
containsIgnoreCase(String srcStr, int sPos, int ePos, String compareStr)
static boolean
containsNAND(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
containsNAND_CI(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
containsOR(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
containsOR_CI(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
containsXOR(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
containsXOR_CI(String srcStr, int sPos, int ePos, String... compareStr)
Starts-With Modifier and Type Method static boolean
startsWithIgnoreCase(String srcStr, String compareStr)
static boolean
startsWithNAND(String srcStr, String... compareStr)
static boolean
startsWithNAND_CI(String srcStr, String... compareStr)
static boolean
startsWithXOR(String srcStr, String... compareStr)
static boolean
startsWithXOR_CI(String srcStr, String... compareStr)
Starts-With, Range-Limited Modifier and Type Method static boolean
startsWith(String srcStr, int sPos, int ePos, String compareStr)
static boolean
startsWithIgnoreCase(String srcStr, int sPos, int ePos, String compareStr)
static boolean
startsWithNAND(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
startsWithNAND_CI(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
startsWithXOR(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
startsWithXOR_CI(String srcStr, int sPos, int ePos, String... compareStr)
Ends-With Modifier and Type Method static boolean
endsWithIgnoreCase(String srcStr, String compareStr)
static boolean
endsWithNAND(String srcStr, String... compareStr)
static boolean
endsWithNAND_CI(String srcStr, String... compareStr)
static boolean
endsWithXOR(String srcStr, String... compareStr)
static boolean
endsWithXOR_CI(String srcStr, String... compareStr)
Ends-With, Range-Limited Modifier and Type Method static boolean
endsWith(String srcStr, int sPos, int ePos, String compareStr)
static boolean
endsWithIgnoreCase(String srcStr, int sPos, int ePos, String compareStr)
static boolean
endsWithNAND(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
endsWithNAND_CI(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
endsWithXOR(String srcStr, int sPos, int ePos, String... compareStr)
static boolean
endsWithXOR_CI(String srcStr, int sPos, int ePos, String... compareStr)
Internal, Protected Helper Methods Modifier and Type Method protected static boolean
AND(String methodName, String srcStr, String[] compareStr, Predicate<String> pred)
protected static boolean
contains(String srcStr, LV l, String compareStr)
protected static boolean
CONTAINS(boolean ignoresCase, byte booleanOperation, String srcStr, String[] cmpStrs)
protected static boolean
CONTAINS(boolean ignoresCase, byte booleanOperation, LV l, String srcStr, String[] cmpStrs)
protected static boolean
containsIgnoreCase(String srcStr, LV l, String compareStr)
protected static boolean
endsWith(String srcStr, LV l, String compareStr)
protected static boolean
endsWithIgnoreCase(String srcStr, LV l, String compareStr)
protected static boolean
equals(String srcStr, LV l, String compareStr)
protected static boolean
equalsIgnoreCase(String srcStr, LV l, String compareStr)
protected static boolean
NAND(String methodName, String srcStr, String[] compareStr, Predicate<String> pred)
protected static boolean
OR(String methodName, String srcStr, String[] compareStr, Predicate<String> pred)
protected static boolean
startsWith(String srcStr, LV l, String compareStr)
protected static boolean
startsWithIgnoreCase(String srcStr, LV l, String compareStr)
protected static boolean
XOR(String methodName, String srcStr, String[] compareStr, Predicate<String> pred)
-
-
-
Field Detail
-
DEBUG
public static boolean DEBUG
Utility field. You may choose to set this variable to true, and the followingString
commands will print to an internally storedConsumer<String> DEBUG_LOG
class that may be set. This is generally a very minor drain on code-efficiency. When this flag is set toFALSE
, a shortif-statement evaluation
still occurs even when the flag is false on each occasion that the string-comparison loops identify and return a match. This is very minor performance loss, and does provide quite a lot of help to those trying to identify difficult to notice problems with partial-String
comparisons.
Required Setting:
In order to use this minor Debugging Feature, it is necessary to provide aConsumer<String>
to public fieldDEBUG_LOG
! This field is apublic
andstatic
field, which will be used by any invocation of the methods in this class. ThisString
-consumer may do anything you would like it to do with the provided Debug-String
data.
String-Format:
TheString
that is ultimately sent to theConsumer<String>
you provide will be formatted, as below, in the following Code-Snippet:
private static void PRNT(String methodName, String srcStr, String compareStr) { DEBUG_LOG.accept(methodName + "-MATCH[" + srcStr + ", " + compareStr + "] "); }
Generally, you would assign a writer that looks like something the Lambda-Target / Function-Pointer assignment in the snippet below:
StrCmpr.DEBUG_LOG = (String logInfoStr) -> System.out.println(logInfoStr);
Finally, if you are using this field, please note that any of the methods whose name ends with the phrase "IgnoreCase" will not print to theDEBUG_LOG
. This is primarily because these are all single-argument comparisons, and logging would be of only minor benefit.
The primary value of a debug-log is the ability to identify whether / when a particular substring from a list of substrings actually matched.
-
DEBUG_LOG
public static java.util.function.Consumer<java.lang.String> DEBUG_LOG
This object reference cannot remain null when the fieldDEBUG
is set toTRUE
. If you have turnedDEBUG
on (by setting the field toTRUE
), and this is null, then aNullPointerException
will be thrown on the very next invocation of any of the methods in this class.
DEBUG_LOG is not Thread-Safe:
No attempt has been made to ensure that this debugging "feature" will operate perfectly in a multi-threaded environment. The two reasons for this are:- The primary purpose of this LOG is for debugging code, not putting details about
string-match information into an 'on-line' or production environment.
- This is a best-efforts string-comparison package that would sacrifice quite a bit of its
utility if it were expected to maintain multiple instances of this class just to have
StrCmpr
debug operations work in multiple-threads. Code readability necessitates keeping this a class with only static methods.
- Two threads making calls to this class
StrCmpr
might see log-writes that, sadly, look like they 'interlaced' (crashed), but even when this occasions, reading the log wouldn't be that difficult anyway.
- The primary purpose of this LOG is for debugging code, not putting details about
string-match information into an 'on-line' or production environment.
-
AND
protected static final byte AND
Signifies that an'AND'
operation is required, but only for methods that implement one of the'contains'
variants.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final byte AND = 0;
-
OR
protected static final byte OR
Signifies that an'AND'
operation is required, but only for methods that implement one of the'contains'
variants.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final byte OR = 1;
-
NAND
protected static final byte NAND
Signifies that an'AND'
operation is required, but only for methods that implement one of the'contains'
variants.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final byte NAND = 2;
-
XOR
protected static final byte XOR
Signifies that an'AND'
operation is required, but only for methods that implement one of the'contains'
variants.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final byte XOR = 3;
-
-
Method Detail
-
AND
protected static boolean AND (java.lang.String methodName, java.lang.String srcStr, java.lang.String[] compareStr, java.util.function.Predicate<java.lang.String> pred)
This performs the internal AND. It expects a comparisonPredicate
in order for the comparison to work.- Parameters:
methodName
- If printing-debug information is expected, by the DEBUG global-variable, thisString
is used.srcStr
- This is the same source-string parameter from all the methods in this class.compareStr
- This is the same var-args string array from all the methods in this class.pred
- This is the comparisonPredicate
provided by the methods in this class that call this method.- Returns:
- The AND of these
String's
, using the providedPredicate
. - Throws:
StrCmprException
- This exception shall throw if there are any invalidString's
in the compare-string parameter array.
IMPORTANT NOTE: The conditions that would cause this exception to throw should remind the reader that each and every method here will throw exception 'StrCmprException' if invalid input has been passed to the "Compare String" Variable-ArgumentsString...
Parameter.- Code:
- Exact Method Body:
StrCmprException.check(compareStr); for (String cmp: compareStr) if (! pred.test(cmp)) { if (DEBUG) PRNT(methodName + "-MATCHFAIL", srcStr, cmp); return false; } return true;
-
NAND
protected static boolean NAND (java.lang.String methodName, java.lang.String srcStr, java.lang.String[] compareStr, java.util.function.Predicate<java.lang.String> pred)
This performs the internal NAND. It expects a comparisonPredicate
in order for the comparison to work.- Parameters:
methodName
- If printing-debug information is expected, by the DEBUG global-variable, thisString
is used.srcStr
- This is the same source-string parameter from all the methods in this class.compareStr
- This is the same var-args string array from all the methods in this class.pred
- This is the comparisonPredicate
provided by the methods in this class that call this method.- Returns:
- The NAND of these
String's
, using the providedPredicate
. - Throws:
StrCmprException
- This exception shall throw if there are any invalidString's
in the compare-string parameter array.
IMPORTANT NOTE: The conditions that would cause this exception to throw should remind the reader that each and every method here will throw exception 'StrCmprException' if invalid input has been passed to the "Compare String" Variable-ArgumentsString...
Parameter.- Code:
- Exact Method Body:
StrCmprException.check(compareStr); for (String cmp: compareStr) if (pred.test(cmp)) { if (DEBUG) PRNT(methodName + "-MATCH", srcStr, cmp); return false; } return true;
-
OR
protected static boolean OR (java.lang.String methodName, java.lang.String srcStr, java.lang.String[] compareStr, java.util.function.Predicate<java.lang.String> pred)
This performs the internal OR. It expects a comparisonPredicate
in order for the comparison to work.- Parameters:
methodName
- If printing-debug information is expected, by the DEBUG global-variable, thisString
is used.srcStr
- This is the same source-string parameter from all the methods in this class.compareStr
- This is the same var-args string array from all the methods in this class.pred
- This is the comparisonPredicate
provided by the methods in this class that call this method.- Returns:
- The OR of these
String's
, using the providedPredicate
. - Throws:
StrCmprException
- This exception shall throw if there are any invalidString's
in the compare-string parameter array.
IMPORTANT NOTE: The conditions that would cause this exception to throw should remind the reader that each and every method here will throw exception 'StrCmprException' if invalid input has been passed to the "Compare String" Variable-ArgumentsString...
Parameter.- Code:
- Exact Method Body:
StrCmprException.check(compareStr); for (String cmp: compareStr) if (pred.test(cmp)) { if (DEBUG) PRNT(methodName + "-MATCH", srcStr, cmp); return true; } return false;
-
XOR
protected static boolean XOR (java.lang.String methodName, java.lang.String srcStr, java.lang.String[] compareStr, java.util.function.Predicate<java.lang.String> pred)
This performs the internal XOR. It expects a comparisonPredicate
in order for the comparison to work.- Parameters:
methodName
- If printing-debug information is expected, by the DEBUG global-variable, thisString
is used.srcStr
- This is the same source-string parameter from all the methods in this class.compareStr
- This is the same var-args string array from all the methods in this class.pred
- This is the comparisonPredicate
provided by the methods in this class that call this method.- Returns:
- The XOR of these
String's
, using the providedPredicate
. - Throws:
StrCmprException
- This exception shall throw if there are any invalidString's
in the compare-string parameter array.
IMPORTANT NOTE: The conditions that would cause this exception to throw should remind the reader that each and every method here will throw exception 'StrCmprException' if invalid input has been passed to the "Compare String" Variable-ArgumentsString...
Parameter.- Code:
- Exact Method Body:
StrCmprException.check(compareStr); int count=0; for (String cmp: compareStr) if (pred.test(cmp)) if (++count > 1) { if (DEBUG) PRNT(methodName + "-MATCH", srcStr, cmp); return false; } return count == 1;
-
equalsXOR
public static boolean equalsXOR(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
equals exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
equals exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return XOR("equalsXOR", srcStr, compareStr, cmp -> srcStr.equals(cmp));
-
equalsNAND
public static boolean equalsNAND(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not equal any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not equal any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return NAND("equalsNAND", srcStr, compareStr, cmp -> srcStr.equals(cmp));
-
equalsXOR_CI
public static boolean equalsXOR_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
equals exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
equals exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return XOR("equalsXOR_CI", srcStr, compareStr, cmp -> srcStr.equalsIgnoreCase(cmp));
-
equalsNAND_CI
public static boolean equalsNAND_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not equal any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not equal any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return NAND("equalsNAND_CI", srcStr, compareStr, cmp -> srcStr.equalsIgnoreCase(cmp));
-
containsOR
public static boolean containsOR(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
contains at least one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
contains at least one of the'compareStr'
instances (andFALSE
otherwise). - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(false, OR, srcStr, compareStr);
-
containsAND
public static boolean containsAND(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
contains every one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
contains every one of the'compareStr'
instances (andFALSE
otherwise). - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(false, AND, srcStr, compareStr);
-
containsXOR
public static boolean containsXOR(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
contains exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
contains exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(false, XOR, srcStr, compareStr);
-
containsNAND
public static boolean containsNAND(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not contain any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not contain any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(false, NAND, srcStr, compareStr);
-
containsOR_CI
public static boolean containsOR_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
contains at least one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
contains at least one of the'compareStr'
instances (andFALSE
otherwise). - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(true, OR, srcStr, compareStr);
-
containsAND_CI
public static boolean containsAND_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
contains every one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
contains every one of the'compareStr'
instances (andFALSE
otherwise). - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(true, AND, srcStr, compareStr);
-
containsXOR_CI
public static boolean containsXOR_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
contains exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
contains exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(true, XOR, srcStr, compareStr);
-
containsNAND_CI
public static boolean containsNAND_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not contain any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not contain any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
CONTAINS(boolean, byte, String, String[])
- Code:
- Exact Method Body:
return CONTAINS(true, NAND, srcStr, compareStr);
-
endsWithXOR
public static boolean endsWithXOR(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
ends with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
ends with exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return XOR("endsWithXOR", srcStr, compareStr, cmp -> srcStr.endsWith(cmp));
-
endsWithNAND
public static boolean endsWithNAND(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not end with any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not end with any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return NAND("endsWithNAND", srcStr, compareStr, cmp -> srcStr.endsWith(cmp));
-
startsWithXOR
public static boolean startsWithXOR(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
starts with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
starts with exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return XOR("startsWithXOR", srcStr, compareStr, cmp -> srcStr.startsWith(cmp));
-
startsWithNAND
public static boolean startsWithNAND(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not start with any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not start with any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return NAND("startsWithNAND", srcStr, compareStr, cmp -> srcStr.startsWith(cmp));
-
endsWithXOR_CI
public static boolean endsWithXOR_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
ends with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
ends with exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
endsWithIgnoreCase(String, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return XOR("endsWithXOR_CI", srcStr, compareStr, cmp -> endsWithIgnoreCase(srcStr, cmp));
-
endsWithNAND_CI
public static boolean endsWithNAND_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not end with any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not end with any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
endsWithIgnoreCase(String, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return NAND("endsWithNAND_CI", srcStr, compareStr, cmp -> endsWithIgnoreCase(srcStr, cmp));
-
startsWithXOR_CI
public static boolean startsWithXOR_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
starts with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
starts with exactly one of the'compareStr'
instances (andFALSE
otherwise).
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - See Also:
startsWithIgnoreCase(String, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return XOR("startsWithXOR_CI", srcStr, compareStr, cmp -> startsWithIgnoreCase(srcStr, cmp));
-
startsWithNAND_CI
public static boolean startsWithNAND_CI(java.lang.String srcStr, java.lang.String... compareStr)
Checks to ensure thatsrcStr
does not start with any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only ifsrcStr
does not start with any of the'compareStr'
instances (andFALSE
otherwise). - See Also:
startsWithIgnoreCase(String, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
return NAND("startsWithNAND_CI", srcStr, compareStr, cmp -> startsWithIgnoreCase(srcStr, cmp));
-
startsWithIgnoreCase
public static boolean startsWithIgnoreCase(java.lang.String srcStr, java.lang.String compareStr)
This performs the exact same comparison as Java'sString.startsWith(String)
method. Java provides an'equalsIgnoreCase()'
method, but not an'startsWithIgnoreCase()'
. This method does just that.- Parameters:
srcStr
- ThisString
is checked to see if it starts with thecompareStr
.compareStr
- ThisString
is checked against thesrcStr
- specifically, ifsrcStr
ends withcompareStr
- Returns:
TRUE
ifsrcStr
starts withcompareStr
(ignoring-case), andFALSE
otherwise.- Code:
- Exact Method Body:
return srcStr.regionMatches(true, 0, compareStr, 0, compareStr.length());
-
endsWithIgnoreCase
public static boolean endsWithIgnoreCase(java.lang.String srcStr, java.lang.String compareStr)
This performs the exact same comparison as Java'sString.endsWith(String)
method. Java provides an'equalsIgnoreCase()'
method, but not an'endsWithIgnoreCase()'
. This method does just that.- Parameters:
srcStr
- ThisString
is checked to see if it ends with thecompareStr
.compareStr
- ThisString
is checked against thesrcStr
- specifically, ifsrcStr
ends withcompareStr
- Returns:
TRUE
ifsrcStr
ends withcompareStr
(ignoring-case), andFALSE
otherwise.- Code:
- Exact Method Body:
int compareStrLen = compareStr.length(); int srcStrLen = srcStr.length(); return srcStr.regionMatches(true, srcStrLen - compareStrLen, compareStr, 0, compareStrLen);
-
containsIgnoreCase
public static boolean containsIgnoreCase(java.lang.String srcStr, java.lang.String compareStr)
This performs the exact same comparison as Java'sString.contains(String)
method. Java provides an'equalsIgnoreCase()'
method, but not a'containsIgnoreCase()'
. This method does just that.- Parameters:
srcStr
- ThisString
is checked to see if it contains thecompareStr
compareStr
- ThisString
is checked against thesrcStr
- specifically, ifcompareStr
is contained bysrcStr
- Returns:
TRUE
ifcompareStr
is a substring ofsrcStr
(ignoring-case), andFALSE
otherwise.- See Also:
containsIgnoreCase(String, LV, String)
- Code:
- Exact Method Body:
return containsIgnoreCase(srcStr, new LV(srcStr, 0, srcStr.length()), compareStr);
-
equalsXOR
public static boolean equalsXOR(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - equals exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) equals exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
equals(String, LV, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return XOR("equalsXOR", srcStr, compareStr, cmp -> equals(srcStr, l, cmp));
-
equalsNAND
public static boolean equalsNAND(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not equal any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not equal any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
equals(String, LV, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return NAND("equalsNAND", srcStr, compareStr, cmp -> equals(srcStr, l, cmp));
-
equalsXOR_CI
public static boolean equalsXOR_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - equals exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) equals exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
equalsIgnoreCase(String, LV, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return XOR("equalsXOR_CI", srcStr, compareStr, cmp -> equalsIgnoreCase(srcStr, l, cmp));
-
equalsNAND_CI
public static boolean equalsNAND_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not equal any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not equal any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
equalsIgnoreCase(String, LV, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return NAND("equalsNAND_CI", srcStr, compareStr, cmp -> equalsIgnoreCase(srcStr, l, cmp));
-
containsOR
public static boolean containsOR(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - contains at least one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains at least one of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(false, OR, l, srcStr, compareStr);
-
containsAND
public static boolean containsAND(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - contains every one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains every one of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(false, AND, l, srcStr, compareStr);
-
containsXOR
public static boolean containsXOR(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - contains exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(false, XOR, l, srcStr, compareStr);
-
containsNAND
public static boolean containsNAND(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not contain any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not contain any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(false, NAND, l, srcStr, compareStr);
-
containsOR_CI
public static boolean containsOR_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - contains at least one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains at least one of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(true, OR, l, srcStr, compareStr);
-
containsAND_CI
public static boolean containsAND_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - contains every one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains every one of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(true, AND, l, srcStr, compareStr);
-
containsXOR_CI
public static boolean containsXOR_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - contains exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(true, XOR, l, srcStr, compareStr);
-
containsNAND_CI
public static boolean containsNAND_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not contain any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not contain any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
CONTAINS(boolean, byte, LV, String, String[])
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return CONTAINS(true, NAND, l, srcStr, compareStr);
-
endsWithXOR
public static boolean endsWithXOR(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - ends with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) ends with exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
endsWith(String, LV, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return XOR("endsWithXOR", srcStr, compareStr, cmp -> endsWith(srcStr, l, cmp));
-
endsWithNAND
public static boolean endsWithNAND(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not end with any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not end with any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
endsWith(String, LV, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return NAND("endsWithNAND", srcStr, compareStr, cmp -> endsWith(srcStr, l, cmp));
-
startsWithXOR
public static boolean startsWithXOR(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - starts with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) starts with exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
startsWith(String, LV, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return XOR("startsWithXOR", srcStr, compareStr, cmp -> startsWith(srcStr, l, cmp));
-
startsWithNAND
public static boolean startsWithNAND(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not start with any of theString's
inside the'compareStr'
array.
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not start with any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
startsWith(String, LV, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return NAND("startsWithNAND", srcStr, compareStr, cmp -> startsWith(srcStr, l, cmp));
-
endsWithXOR_CI
public static boolean endsWithXOR_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - ends with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) ends with exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
endsWithIgnoreCase(String, LV, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return XOR("endsWithXOR_CI", srcStr, compareStr, cmp -> endsWithIgnoreCase(srcStr, l, cmp));
-
endsWithNAND_CI
public static boolean endsWithNAND_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not end with any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not end with any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
endsWithIgnoreCase(String, LV, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return NAND("endsWithNAND_CI", srcStr, compareStr, cmp -> endsWithIgnoreCase(srcStr, l, cmp));
-
startsWithXOR_CI
public static boolean startsWithXOR_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - starts with exactly one of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) starts with exactly one of the'compareStr'
values.
An internal counter is maintained, and it must equal precisely one prior to exit in order for TRUE to be returned. In the case that multiple copies of an identicalString
have been passed into parameterString[] compareStr
, the returned-answer is best considered non-deterministic.. In practice, a second copy of an identical-String
(or identical-ignoring case) will force the XOR comparison to returnFALSE
NOTE: No exception checks are performed oncompareStr
for duplicate elements in that array. This check is avoied essentially due to the performance over-head of checking for it. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
startsWithIgnoreCase(String, LV, String)
,XOR(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return XOR("startsWithXOR_CI", srcStr, compareStr, cmp -> startsWithIgnoreCase(srcStr, l, cmp));
-
startsWithNAND_CI
public static boolean startsWithNAND_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String... compareStr)
Checks to ensure the substring ofsrcStr
- demarcated by the parameters'sPos'
(inclusive) and'ePos'
(exclusive) - does not start with any of theString's
inside the'compareStr'
array.
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
compareStr
- TheString's
used in the comparison against'srcStr'
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) does not start with any of the'compareStr'
values. - Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
startsWithIgnoreCase(String, LV, String)
,NAND(String, String, String[], Predicate)
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); return NAND("startsWithNAND_CI", srcStr, compareStr, cmp -> startsWithIgnoreCase(srcStr, l, cmp));
-
equals
public static boolean equals(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
equals'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) equals'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
equals(String, LV, String)
- Code:
- Exact Method Body:
return equals(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
equalsIgnoreCase
public static boolean equalsIgnoreCase(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
equals'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) equals'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
equalsIgnoreCase(String, LV, String)
- Code:
- Exact Method Body:
return equalsIgnoreCase(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
startsWith
public static boolean startsWith(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
starts with'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) starts with'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
startsWith(String, LV, String)
- Code:
- Exact Method Body:
return startsWith(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
startsWithIgnoreCase
public static boolean startsWithIgnoreCase(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
starts with'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) starts with'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
startsWithIgnoreCase(String, LV, String)
- Code:
- Exact Method Body:
return startsWithIgnoreCase(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
endsWith
public static boolean endsWith(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
ends with'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) ends with'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
endsWith(String, LV, String)
- Code:
- Exact Method Body:
return endsWith(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
endsWithIgnoreCase
public static boolean endsWithIgnoreCase(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
ends with'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) ends with'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
endsWithIgnoreCase(String, LV, String)
- Code:
- Exact Method Body:
return endsWithIgnoreCase(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
contains
public static boolean contains(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
contains'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
contains(String, LV, String)
- Code:
- Exact Method Body:
return contains(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
containsIgnoreCase
public static boolean containsIgnoreCase(java.lang.String srcStr, int sPos, int ePos, java.lang.String compareStr)
Checks whether or not a substring of'srcStr'
contains'compareStr'
. The substring that is checked is demarcated by'sPos'
(inclusive), and'ePos'
(exclusive).
The test performed here ** is not ** case-sensitive.- Parameters:
srcStr
- Any non-null instance of ajava.lang.String
compareStr
- TheString
used in the comparison against'srcStr'
sPos
- This is the integer-indexString
-location which limits the left-most position to search in'srcStr'
. This value is 'inclusive,' meaning that if the character at this index (in'srcStr'
) is part of a match, it shall be factored into the return results. Note that if this value is negative, or larger than the length of'srcStr'
, an exception will be thrown.ePos
- This is the integer-indexString
-location which limits the right-most position to search in'srcStr'
. This value is 'exclusive,' meaning that if the character at this location is part of match, it will not be calculated into the results.
If this value is larger than the length of input-parameter'srcStr'
, an exception will throw.
NOTE: Passing a negative value to this parameter,'ePos'
, will cause its to be reset to the integer-value:srcStr.length()
- Returns:
- This will return
TRUE
if and only if the specified substring between'sPos'
and'ePos'
(extraced from'srcStr'
) contains'compareStr'
- Throws:
java.lang.StringIndexOutOfBoundsException
- This exception shall be thrown if any of the following are true:- If
'sPos'
is negative, or ifsPos
is greater-than-or-equal-to thelength
of theString
- If
'ePos'
is zero, or greater than the length of theString
- If the value of
'sPos'
is a larger integer than'ePos'
. IfePos
was negative, it is first reset toString.length()
, before this check is done.
- If
- See Also:
containsIgnoreCase(String, LV, String)
- Code:
- Exact Method Body:
return containsIgnoreCase(srcStr, new LV(srcStr, sPos, ePos), compareStr);
-
equals
-
equalsIgnoreCase
protected static boolean equalsIgnoreCase(java.lang.String srcStr, LV l, java.lang.String compareStr)
This method remains'protected'
because it utilizes a specialized Loop-Control Variable Class Version of'LV'
. It is used internally by the search methods above.
-
startsWith
protected static boolean startsWith(java.lang.String srcStr, LV l, java.lang.String compareStr)
This method remains'protected'
because it utilizes a specialized Loop-Control Variable Class Version of'LV'
. It is used internally by the search methods above.
-
startsWithIgnoreCase
protected static boolean startsWithIgnoreCase(java.lang.String srcStr, LV l, java.lang.String compareStr)
This method remains'protected'
because it utilizes a specialized Loop-Control Variable Class Version of'LV'
. It is used internally by the search methods above.
-
endsWith
-
endsWithIgnoreCase
protected static boolean endsWithIgnoreCase(java.lang.String srcStr, LV l, java.lang.String compareStr)
This method remains'protected'
because it utilizes a specialized Loop-Control Variable Class Version of'LV'
. It is used internally by the search methods above.
-
contains
-
containsIgnoreCase
protected static boolean containsIgnoreCase(java.lang.String srcStr, LV l, java.lang.String compareStr)
This method remains'protected'
because it utilizes a specialized Loop-Control Variable Class Version of'LV'
. It is used internally by the search methods above.
-
CONTAINS
protected static boolean CONTAINS(boolean ignoresCase, byte booleanOperation, LV l, java.lang.String srcStr, java.lang.String[] cmpStrs)
Implementing a 'contains' is more efficient by performing only one loop iteration. Therefore, the methods that implement some variant of theString.contains
method will use this general-purposecontains
-testing method.- Parameters:
ignoresCase
- This is used to signify whether to ignore case when performing theString
-comparison operations.booleanOperation
- This is designed to take one of four values. This method will throw an exception if it does not.l
- Loop end-point parametersrcStr
- Any non-null instance ofjava.lang.String
cmpStrs
- This is one (or many) javaString's
, each of which shall be compared to the ending of'srcStr'
.- Returns:
- The appropriate response based on the inputs for boolean logic.
- Code:
- Exact Method Body:
// Check each of the compare-strs first. It will provide a better exception message for (String s : cmpStrs) if (s == null) throw new NullPointerException ("One of the elements of 'compareStr' was null"); if ((booleanOperation < 0) || (booleanOperation > 3)) throw new IllegalArgumentException (CONTAINS_EX.replace("BOOL", "" + booleanOperation)); int count = (booleanOperation == XOR) ? 0 : cmpStrs.length; cmpStrs = cmpStrs.clone(); // Iterate each character in the String, and use it as the start to "regionMatches" for (int i=l.start; i < l.end; i++) INNER: // Iterate each of the "compareison strings" - each are passed to "regionMatches" for (int j=0; j < cmpStrs.length; j++) // The Strings in Compare-Str are sometimes set to null, if they are skip them if (cmpStrs[j] != null) if (srcStr.regionMatches(ignoresCase, i, cmpStrs[j], 0, cmpStrs[j].length())) switch (booleanOperation) { case AND : cmpStrs[j]=null; // no need to check for it again if (--count == 0) return true; else continue INNER; // test-all cmpStrs case XOR : cmpStrs[j]=null; // no need to check for it again if (++count > 1) return false; else continue INNER; // test-all cmpStrs case OR : return true; case NAND : return false; } switch(booleanOperation) { case AND : return false; case OR : return false; case XOR : return count == 1; case NAND : return true; } // Already Checked boolean-operation, there is no way to reach this line of code. throw new UnreachableError();
-
CONTAINS
protected static boolean CONTAINS(boolean ignoresCase, byte booleanOperation, java.lang.String srcStr, java.lang.String[] cmpStrs)
Implementing a 'contains' is more efficient by performing only one loop iteration. Therefore, the methods that implement some variant of theString.contains
method will use this general-purposecontains
-testing method.- Parameters:
ignoresCase
- This is used to signify whether to ignore case when performing theString
-comparison operations.booleanOperation
- This is designed to take one of four values. This method will throw an exception if it does not.srcStr
- Any non-null instance ofjava.lang.String
cmpStrs
- This is one (or many) javaString's
, each of which shall be compared to the ending of'srcStr'
.- Returns:
- The appropriate response based on the inputs for boolean logic.
- Code:
- Exact Method Body:
// Check each of the compare-strs first. It will provide a better exception message for (String s : cmpStrs) if (s == null) throw new NullPointerException ("One of the elements of 'compareStr' was null"); if ((booleanOperation < 0) || (booleanOperation > 3)) throw new IllegalArgumentException (CONTAINS_EX.replace("BOOL", "" + booleanOperation)); int count = (booleanOperation == XOR) ? 0 : cmpStrs.length; int len = srcStr.length(); cmpStrs = cmpStrs.clone(); // Iterate each character in the String, and use it as the start to "regionMatches" for (int i=0; i < len; i++) INNER: // Iterate each of the "compareison strings" - each are passed to "regionMatches" for (int j=0; j < cmpStrs.length; j++) // The Strings in Compare-Str are sometimes set to null, if they are skip them if (cmpStrs[j] != null) if (srcStr.regionMatches(ignoresCase, i, cmpStrs[j], 0, cmpStrs[j].length())) switch (booleanOperation) { case AND : cmpStrs[j]=null; // no need to check for it again if (--count == 0) return true; else continue INNER; // test-all cmpStrs case XOR : cmpStrs[j]=null; // no need to check for it again if (++count > 1) return false; else continue INNER; // test-all cmpStrs case OR : return true; case NAND : return false; } switch(booleanOperation) { case AND : return false; case OR : return false; case XOR : return count == 1; case NAND : return true; } // Already Checked boolean-operation, there is no way to reach this line of code. throw new UnreachableError();
-
-