Package Torello.Java
Class StrTokIndexOf
- java.lang.Object
-
- Torello.Java.StrTokIndexOf
-
public class StrTokIndexOf extends java.lang.Object
Automatic Code-Generator:
The code in this class was automatically built using a code-generator. The source-code for this generator may be viewed in the link below. It is somewhat simplistic, in that JavaString's
andStringBuilder's
are used. It did get the job done.
TokIndexOfCodeGen.java
This code was developed over two years ago (2020), and has not changed much.The purpose of this class is to help find the location ofToken-Matches
inside of an input source-String
.StrTokIndexOf =>
StrTok:
Token-Matches
are substring matches which are found inside a supplied'srcStr'
. These matches must be both fully contained within'srcStr'
, and have "match locations" (String
-index position in'srcStr'
where the token matches) that are bounded / 'surrounded' by either white-space (space-character'#32', '\n', '\r', etc
) or by characters that pass a user suppliedCharacter-Predicate test()
.
IndexOf:
Each of the methods in this class shall return an integer, orint[] array
of indices into the inputString 'srcStr'
where match-locations were found.
Normally, checking for an occurrence of a substring inside of a JavaString
is as easy as calling the methodString.contains(substring)
. Problems can crop up, however, when working withString's
whose contents have derived from HTML-Attributes.
For instance, when working with the HTML Element Attribute'CLASS=...'
, simply making a call toString.contains(cssClassName)
to find if it is a member of'cssClassName'
would return many incorrect results due to the fact that thecssClassName
- if occurring within the list of CSS Classes - is only considered a match if that class-name is bounded on both sides by white-space or the start (or end) of the CSS'CLASS'
Attribute-Value. ThisStrTokIndexOf
is nearly identical to the class with the similarly chosen nameStrIndexOf
; but differs in that the matches it finds are only considered matches when the sub-string the logic is searching is found, by itself, like a separate word in theString
being searched.
The following examples will hopefully make more clear what aToken-Match
actually is:
Example:
int pos = StrTokIndexOf.first("This is a warm, sunny afternoon in August.", "war"); // 'pos' would evaluate to -1, because 'war' was not found as a token. HOWEVER... int pos = StrIndexOf.first("This is a warm, sunny afternoon in August.", "war"); // 'pos' would evaluate to 10, because the word 'warm' begins with 'war' and the // first letter of 'warm' is located at string-index 10. TagNode tn = new TagNode("<DIV CLASS='PersonalPics' ID='Photos-10'>"); String cssClass = "Pics"; boolean found = StrTokIndexOf.first(tn.AV("class"), cssClass) != -1; // 'found' would evaluate to FALSE, because though 'PersonalPics' contains the substring // 'Pics', it is not an actually CSS Class String match. The concept of "Token-Match" is // identical to how CSS Parsers look for Class String's // NOTE: boolean found = StrIndexOf.first(tn.AV("class"), cssClass) != -1; // 'found' would evaluate to TRUE, because 'Pics' is a substring of 'PersonalPics' // but this would be a mistake since, as a CSS class, this token is not really one of the // CSS Classes contained by the HTML divider element.
Methods Available
Method Explanation first (...) This will retrieve an integer-pointer that points to the first String-Token
match found within the inputString
-parameter'srcStr'
.nth (...) This will retrieve an integer-pointer that points to the nth String-Token
match found within the inputString
-parameter'srcStr'
.last (...) This will retrieve an integer-pointer that points to the last String-Token
match found within the inputString
-parameter'srcStr'
.nthFromEnd (...) This will retrieve an integer-pointer that points to the nth-from-last String-Token
match found within the inputString
-parameter'srcStr'
.all (...) This will retrieve an integer-pointer to every String-Token
match found within the inputString
-parameter'srcStr'
.Method Parameters
Parameter Explanation String srcStr
This parameter is mandatory for every method here. It is the source String
that is being searched. Every method is designed to iterate through the characters in thisString
, searching for matches ofString
orchar
parameter'token'
.int nth
This represents the 'nth'
match of a comparisonfor-loop
. When the method-signature used includes the parameter'nth'
, the firstn-1
matches that are found - will be skipped, and the'nth'
match is, instead, returned.
EXCEPTIONS: AnNException
shall throw if the value of parameter'nth'
is zero, negative, or larger than the size of the input html-Vector
.int sPos, int ePos
When these parameters are present, only substring's
that are found between these specifiedString
indices will be considered when returning results fromStrTokIndexOf
.
NOTE: In every situation where the parametersint sPos, int ePos
are used, parameter'ePos'
will accept a negative value, but parameter'sPos'
will not. When'ePos'
is passed a negative-value, the internalLV
('Loop Variable Counter') will have itspublic final int end
field set to the length of the'srcStr'
parameterString
.
EXCEPTIONS: AnIndexOutOfBoundsException
will be thrown if:- If
sPos
is negative, or ifsPos
is greater-than or equal-to the size of'srcStr'
- If
ePos
is zero, or greater than the size'srcStr'
. - If
sPos
is a larger integer thanePos
String token
This is the testing-substring that is this class' search goal. When this String
is identified as a substring of the input-parameterString 'srcStr'
, a potential match has been found. In order for potential matches to be returned as results, they are subsequently tested forsurrounding white-space
(or the additional'extraDelimiterTest'
). The requirements for a potential match to be returned as aToken Match
are as follows:- The location of
'token'
in'srcStr'
must be bounded by white-space, or be located at the very beginning or ending of the'srcStr'
. - If an
extraDelimiterTest
has been provided, the location of'token'
in'srcStr'
may also be bounded by characters that are a match with theCharacter-Predicate
'test(char)'
method. - And, of course, the
'token'
must be a substring of'srcStr'
char token
This parameter is used indentically to parameter String token
. However, rather than searching for sub-string matches, the search-loops are looking for copies of character'token'
. All the rules listed in the previous parameter entry (above) apply to this parameter too.Predicate<Character> extraDelimiterTest
When this parameter is present in the method-signature parameter-list, the decision of whether a Token-Match
is to be included in the search result-set can be made less restrictive. Usually, a match must be delimited by white-space; meaning that the characters directly before and after the match location in'srcStr'
must be white-space, or theString terminus
(Regex:'^'
and'$'
).
However, when this parameter is part of a method signature, the method body in this class that implements this search will also permit atoken-match
location to be bounded by characters that pass thisCharacter-Predicate's Predicate.test(char)
method.
For instance, if(Character c) -> ",.!?()".contains("" + c)
were passed to this parameter, then:commas, periods, exclamation-points, question-marks,
andparenthesis
would all be allowed directly before or immediately after thetoken-match
location of the'token'
parameter insideString 'srcStr'
.Return Values:
int
represents a position index ofString
parameter'srcStr'
.- A return value of
-1
implies no matches were found. int[]
A list of position indices wheretoken-matches
were found.- A zero-length
int[]
array means no matches were found in'srcStr'
. Zero-length arrays are returned from any method where the possibility existed for multiple-matches being provided as a result-set. Null will not be returned.
Hi-Lited Source-Code:- View Here: Torello/Java/StrTokIndexOf.java
- Open New Browser-Tab: Torello/Java/StrTokIndexOf.java
File Size: 199,845 Bytes Line Count: 4,556 '\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
- 96 Method(s), 96 declared static
- 0 Field(s)
-
-
Method Summary
All Modifier and Type Method static int[]
all(String srcStr, char c)
static int[]
all(String srcStr, String token)
static int[]
all_CI(String srcStr, char c)
static int[]
all_CI(String srcStr, String token)
All, Range-Limited Modifier and Type Method static int[]
all(String srcStr, int sPos, int ePos, char c)
static int[]
all(String srcStr, int sPos, int ePos, String token)
static int[]
all_CI(String srcStr, int sPos, int ePos, char c)
static int[]
all_CI(String srcStr, int sPos, int ePos, String token)
All w/ Extra-Delimiter Test Modifier and Type Method static int[]
all(String srcStr, char c, Predicate<Character> extraDelimiterTest)
static int[]
all(String srcStr, String token, Predicate<Character> extraDelimiterTest)
static int[]
all_CI(String srcStr, char c, Predicate<Character> extraDelimiterTest)
static int[]
all_CI(String srcStr, String token, Predicate<Character> extraDelimiterTest)
All, Range-Limited w/ Extra-Delimiter Test Modifier and Type Method static int[]
all(String srcStr, int sPos, int ePos, char c, Predicate<Character> extraDelimiterTest)
static int[]
all(String srcStr, int sPos, int ePos, String token, Predicate<Character> extraDelimiterTest)
static int[]
all_CI(String srcStr, int sPos, int ePos, char c, Predicate<Character> extraDelimiterTest)
static int[]
all_CI(String srcStr, int sPos, int ePos, String token, Predicate<Character> extraDelimiterTest)
First Modifier and Type Method static int
first(String srcStr, char c)
static int
first(String srcStr, String token)
static int
first_CI(String srcStr, char c)
static int
first_CI(String srcStr, String token)
First, Range-Limited Modifier and Type Method static int
first(String srcStr, int sPos, int ePos, char c)
static int
first(String srcStr, int sPos, int ePos, String token)
static int
first_CI(String srcStr, int sPos, int ePos, char c)
static int
first_CI(String srcStr, int sPos, int ePos, String token)
First w/ Extra-Delimiter Test Modifier and Type Method static int
first(String srcStr, char c, Predicate<Character> extraDelimiterTest)
static int
first(String srcStr, String token, Predicate<Character> extraDelimiterTest)
static int
first_CI(String srcStr, char c, Predicate<Character> extraDelimiterTest)
static int
first_CI(String srcStr, String token, Predicate<Character> extraDelimiterTest)
First, Range-Limited w/ Extra-Delimiter Test Modifier and Type Method static int
first(String srcStr, int sPos, int ePos, char c, Predicate<Character> extraDelimiterTest)
static int
first(String srcStr, int sPos, int ePos, String token, Predicate<Character> extraDelimiterTest)
static int
first_CI(String srcStr, int sPos, int ePos, char c, Predicate<Character> extraDelimiterTest)
static int
first_CI(String srcStr, int sPos, int ePos, String token, Predicate<Character> extraDelimiterTest)
Last Modifier and Type Method static int
last(String srcStr, char c)
static int
last(String srcStr, String token)
static int
last_CI(String srcStr, char c)
static int
last_CI(String srcStr, String token)
Last, Range-Limited Modifier and Type Method static int
last(String srcStr, int sPos, int ePos, char c)
static int
last(String srcStr, int sPos, int ePos, String token)
static int
last_CI(String srcStr, int sPos, int ePos, char c)
static int
last_CI(String srcStr, int sPos, int ePos, String token)
Last w/ Extra-Delimiter Test Modifier and Type Method static int
last(String srcStr, char c, Predicate<Character> extraDelimiterTest)
static int
last(String srcStr, String token, Predicate<Character> extraDelimiterTest)
static int
last_CI(String srcStr, char c, Predicate<Character> extraDelimiterTest)
static int
last_CI(String srcStr, String token, Predicate<Character> extraDelimiterTest)
Last, Range-Limited w/ Extra-Delimiter Test Modifier and Type Method static int
last(String srcStr, int sPos, int ePos, char c, Predicate<Character> extraDelimiterTest)
static int
last(String srcStr, int sPos, int ePos, String token, Predicate<Character> extraDelimiterTest)
static int
last_CI(String srcStr, int sPos, int ePos, char c, Predicate<Character> extraDelimiterTest)
static int
last_CI(String srcStr, int sPos, int ePos, String token, Predicate<Character> extraDelimiterTest)
Nth Modifier and Type Method static int
nth(String srcStr, int n, char c)
static int
nth(String srcStr, int n, String token)
static int
nth_CI(String srcStr, int n, char c)
static int
nth_CI(String srcStr, int n, String token)
Nth, Range-Limited Modifier and Type Method static int
nth(String srcStr, int sPos, int ePos, int n, char c)
static int
nth(String srcStr, int sPos, int ePos, int n, String token)
static int
nth_CI(String srcStr, int sPos, int ePos, int n, char c)
static int
nth_CI(String srcStr, int sPos, int ePos, int n, String token)
Nth w/ Extra-Delimiter Test Modifier and Type Method static int
nth(String srcStr, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nth(String srcStr, int n, String token, Predicate<Character> extraDelimiterTest)
static int
nth_CI(String srcStr, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nth_CI(String srcStr, int n, String token, Predicate<Character> extraDelimiterTest)
Nth, Range-Limited w/ Extra-Delimiter Test Modifier and Type Method static int
nth(String srcStr, int sPos, int ePos, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nth(String srcStr, int sPos, int ePos, int n, String token, Predicate<Character> extraDelimiterTest)
static int
nth_CI(String srcStr, int sPos, int ePos, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nth_CI(String srcStr, int sPos, int ePos, int n, String token, Predicate<Character> extraDelimiterTest)
Nth-From-End Modifier and Type Method static int
nthFromEnd(String srcStr, int n, char c)
static int
nthFromEnd(String srcStr, int n, String token)
static int
nthFromEnd_CI(String srcStr, int n, char c)
static int
nthFromEnd_CI(String srcStr, int n, String token)
Nth-From-End, Range-Limited Modifier and Type Method static int
nthFromEnd(String srcStr, int sPos, int ePos, int n, char c)
static int
nthFromEnd(String srcStr, int sPos, int ePos, int n, String token)
static int
nthFromEnd_CI(String srcStr, int sPos, int ePos, int n, char c)
static int
nthFromEnd_CI(String srcStr, int sPos, int ePos, int n, String token)
Nth-From-End w/ Extra-Delimiter Test Modifier and Type Method static int
nthFromEnd(String srcStr, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nthFromEnd(String srcStr, int n, String token, Predicate<Character> extraDelimiterTest)
static int
nthFromEnd_CI(String srcStr, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nthFromEnd_CI(String srcStr, int n, String token, Predicate<Character> extraDelimiterTest)
Nth-From-End, Range-Limited w/ Extra-Delimiter Test Modifier and Type Method static int
nthFromEnd(String srcStr, int sPos, int ePos, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nthFromEnd(String srcStr, int sPos, int ePos, int n, String token, Predicate<Character> extraDelimiterTest)
static int
nthFromEnd_CI(String srcStr, int sPos, int ePos, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nthFromEnd_CI(String srcStr, int sPos, int ePos, int n, String token, Predicate<Character> extraDelimiterTest)
Left Modifier and Type Method static int
left(String srcStr, int fromIndex, char c)
static int
left(String srcStr, int fromIndex, String token)
static int
left_CI(String srcStr, int fromIndex, char c)
static int
left_CI(String srcStr, int fromIndex, String token)
Left w/ Extra-Delimiter Test Modifier and Type Method static int
left(String srcStr, int fromIndex, char c, Predicate<Character> extraDelimiterTest)
static int
left(String srcStr, int fromIndex, String token, Predicate<Character> extraDelimiterTest)
static int
left_CI(String srcStr, int fromIndex, char c, Predicate<Character> extraDelimiterTest)
static int
left_CI(String srcStr, int fromIndex, String token, Predicate<Character> extraDelimiterTest)
Nth-Left Modifier and Type Method static int
nthLeft(String srcStr, int fromIndex, int n, char c)
static int
nthLeft(String srcStr, int fromIndex, int n, String token)
static int
nthLeft_CI(String srcStr, int fromIndex, int n, char c)
static int
nthLeft_CI(String srcStr, int fromIndex, int n, String token)
Nth-Left w/ Extra-Delimiter Test Modifier and Type Method static int
nthLeft(String srcStr, int fromIndex, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nthLeft(String srcStr, int fromIndex, int n, String token, Predicate<Character> extraDelimiterTest)
static int
nthLeft_CI(String srcStr, int fromIndex, int n, char c, Predicate<Character> extraDelimiterTest)
static int
nthLeft_CI(String srcStr, int fromIndex, int n, String token, Predicate<Character> extraDelimiterTest)
-
-
-
Method Detail
-
all_CI
public static int[] all_CI (java.lang.String srcStr, int sPos, int ePos, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); IntStream.Builder b = IntStream.builder(); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI(java.lang.String srcStr, int sPos, int ePos, char c)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); IntStream.Builder b = IntStream.builder(); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI (java.lang.String srcStr, int sPos, int ePos, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String token)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI (java.lang.String srcStr, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); IntStream.Builder b = IntStream.builder(); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI(java.lang.String srcStr, char c)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); IntStream.Builder b = IntStream.builder(); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI (java.lang.String srcStr, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI(java.lang.String srcStr, java.lang.String token)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all (java.lang.String srcStr, int sPos, int ePos, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); IntStream.Builder b = IntStream.builder(); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, int sPos, int ePos, char c)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); IntStream.Builder b = IntStream.builder(); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all (java.lang.String srcStr, int sPos, int ePos, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, int sPos, int ePos, java.lang.String token)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all (java.lang.String srcStr, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); IntStream.Builder b = IntStream.builder(); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, char c)
Search for alltoken
-matches ofchar
-parameter'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); IntStream.Builder b = IntStream.builder(); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all (java.lang.String srcStr, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, java.lang.String token)
Search for alltoken
-matches ofString
-param'token'
in'srcStr'
, and return an integer-array of index-locations into'srcStr'
indicating where matches have occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an integer-array ofString
-index pointers will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- An integer-pointer array of all
java.lang.String
-indices where matches were found.
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); IntStream.Builder b = IntStream.builder(); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) b.accept(i); return b.build().toArray();
-
first_CI
public static int first_CI (java.lang.String srcStr, int sPos, int ePos, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
first_CI
public static int first_CI(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
first_CI
public static int first_CI (java.lang.String srcStr, int sPos, int ePos, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
first_CI
public static int first_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String token)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
first_CI
public static int first_CI (java.lang.String srcStr, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
first_CI
public static int first_CI(java.lang.String srcStr, char c)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
first_CI
public static int first_CI (java.lang.String srcStr, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
first_CI
public static int first_CI(java.lang.String srcStr, java.lang.String token)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
first
public static int first (java.lang.String srcStr, int sPos, int ePos, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
first
public static int first(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
first
public static int first (java.lang.String srcStr, int sPos, int ePos, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
first
public static int first(java.lang.String srcStr, int sPos, int ePos, java.lang.String token)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
first
public static int first (java.lang.String srcStr, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
first
public static int first(java.lang.String srcStr, char c)
Search for the firsttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
first
public static int first (java.lang.String srcStr, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
first
public static int first(java.lang.String srcStr, java.lang.String token)
Search for the firsttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the first identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last_CI
public static int last_CI (java.lang.String srcStr, int sPos, int ePos, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
last_CI
public static int last_CI (java.lang.String srcStr, int sPos, int ePos, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String token)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last_CI
public static int last_CI (java.lang.String srcStr, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, char c)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
last_CI
public static int last_CI (java.lang.String srcStr, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, java.lang.String token)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last
public static int last (java.lang.String srcStr, int sPos, int ePos, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
last
public static int last(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
last
public static int last (java.lang.String srcStr, int sPos, int ePos, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last
public static int last(java.lang.String srcStr, int sPos, int ePos, java.lang.String token)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
- Code:
- Exact Method Body:
LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last
public static int last (java.lang.String srcStr, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
last
public static int last(java.lang.String srcStr, char c)
Search for the lasttoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
last
public static int last (java.lang.String srcStr, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
last
public static int last(java.lang.String srcStr, java.lang.String token)
Search for the lasttoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the last identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
nth_CI
public static int nth_CI (java.lang.String srcStr, int sPos, int ePos, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI(java.lang.String srcStr, int sPos, int ePos, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI (java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI(java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI (java.lang.String srcStr, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI(java.lang.String srcStr, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=l.start; i < l.end; i++) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI (java.lang.String srcStr, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI(java.lang.String srcStr, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth (java.lang.String srcStr, int sPos, int ePos, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth(java.lang.String srcStr, int sPos, int ePos, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth (java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth(java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth (java.lang.String srcStr, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth(java.lang.String srcStr, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); for (int i=l.start; i < l.end; i++) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth (java.lang.String srcStr, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nth
public static int nth(java.lang.String srcStr, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, and return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=l.start; i < l.end; i++) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI (java.lang.String srcStr, int sPos, int ePos, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI(java.lang.String srcStr, int sPos, int ePos, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI (java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI(java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI (java.lang.String srcStr, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI(java.lang.String srcStr, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); c = Character.toLowerCase(c); for (int i=(l.end-1); i >= l.start; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI (java.lang.String srcStr, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI(java.lang.String srcStr, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd (java.lang.String srcStr, int sPos, int ePos, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd(java.lang.String srcStr, int sPos, int ePos, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd (java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd(java.lang.String srcStr, int sPos, int ePos, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive
This method allows sub-sections, or 'partial-sections', of thejava.lang.String
to be checked. This is done via theint 'sPos'
and theint 'ePos'
parameters. These are indices into the'srcStr'
input-parameter.- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.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()
n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - 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
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, sPos, ePos, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd (java.lang.String srcStr, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd(java.lang.String srcStr, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1); for (int i=(l.end-1); i >= l.start; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd (java.lang.String srcStr, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd(java.lang.String srcStr, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
but start the search with the last character of the String, and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, counting left from the end of'srcStr'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, -1, token.length()); int tokenLen = token.length(); for (int i=(l.end-1); i >= l.start; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
left_CI
public static int left_CI (java.lang.String srcStr, int fromIndex, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofchar
-parameter'c'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex); c = Character.toLowerCase(c); for (int i=l.end; i >= 0; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
left_CI
public static int left_CI(java.lang.String srcStr, int fromIndex, char c)
Search for the firsttoken
-match ofchar
-parameter'c'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex); c = Character.toLowerCase(c); for (int i=l.end; i >= 0; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
left_CI
public static int left_CI (java.lang.String srcStr, int fromIndex, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofString
-param'token'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
left_CI
public static int left_CI(java.lang.String srcStr, int fromIndex, java.lang.String token)
Search for the firsttoken
-match ofString
-param'token'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
left
public static int left (java.lang.String srcStr, int fromIndex, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofchar
-parameter'c'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex); for (int i=l.end; i >= 0; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) return i; return -1;
-
left
public static int left(java.lang.String srcStr, int fromIndex, char c)
Search for the firsttoken
-match ofchar
-parameter'c'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex); for (int i=l.end; i >= 0; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) return i; return -1;
-
left
public static int left (java.lang.String srcStr, int fromIndex, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the firsttoken
-match ofString
-param'token'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
left
public static int left(java.lang.String srcStr, int fromIndex, java.lang.String token)
Search for the firsttoken
-match ofString
-param'token'
searching left beginning at'srcStr'
position'fromIndex'
. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) return i; return -1;
-
nthLeft_CI
public static int nthLeft_CI (java.lang.String srcStr, int fromIndex, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex); c = Character.toLowerCase(c); for (int i=l.end; i >= 0; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthLeft_CI
public static int nthLeft_CI(java.lang.String srcStr, int fromIndex, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex); c = Character.toLowerCase(c); for (int i=l.end; i >= 0; i--) if ( (c == Character.toLowerCase(srcStr.charAt(i))) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthLeft_CI
public static int nthLeft_CI (java.lang.String srcStr, int fromIndex, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthLeft_CI
public static int nthLeft_CI(java.lang.String srcStr, int fromIndex, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(true, i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthLeft
public static int nthLeft (java.lang.String srcStr, int fromIndex, int n, char c, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputchar 'c'
parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex); for (int i=l.end; i >= 0; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1)) || extraDelimiterTest.test(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthLeft
public static int nthLeft(java.lang.String srcStr, int fromIndex, int n, char c)
Search for the nthtoken
-match ofchar
-parameter'c'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forchar
-parameter'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-Character
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of achar-TOKEN
match will be defined as nearly identical to a regular'contains-character'
match, with the added requirement that BOTH the character directly preceding the matching-char
AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex); for (int i=l.end; i >= 0; i--) if ( (c == srcStr.charAt(i)) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i+1) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i+1))) ) if (--n == 0) return i; return -1;
-
nthLeft
public static int nthLeft (java.lang.String srcStr, int fromIndex, int n, java.lang.String token, java.util.function.Predicate<java.lang.Character> extraDelimiterTest)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.extraDelimiterTest
- When this method makestoken
comparisons using the inputString
-token parameter, if the logic finds a match anywhere withinString
parameter'srcStr'
, it will check both the character immediately preceding and the character directly after that match before considering the match as a token-match. ThisPredicate<Character>
test allows the programmer to identify characters in addition to white-space that identify the match as a token match.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
)
④ Any character that matches the user-providedPredicate<Character> 'extraDelimiterTest'
- Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1)) || extraDelimiterTest.test(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen)) || extraDelimiterTest.test(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
nthLeft
public static int nthLeft(java.lang.String srcStr, int fromIndex, int n, java.lang.String token)
Search for the nthtoken
-match ofString
-param'token'
in'srcStr'
, but begin the search at index-position'fromIndex'
and work left. Return the integer index-location into'srcStr'
where the match occured.
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. Its contents will be searched for the specifiedtoken
-matches, and an an index-pointer (an integer) will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.n
- This is the number of matches to skip when searching forString
-param'token'
before returning an answer.token
- This is the sub-string that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
'srcStr' String
-index of the nth identifiedTOKEN-String
match in'srcStr'
, performing the search in the left direction, beginning atString
-index'fromIndex'
NOTE: The concept of aTOKEN
match will be defined as nearly identical to a sub-string match, with the added requirement that BOTH the character directly preceding the sub-string match AND the character immediately following it may only equal one of these values:
① white-space (matching'\s'
)
②String
-start (matching'^'
)
③String
-terminus (matching'$'
) - Throws:
NException
- If the value of'n'
is negative, or greater thansrcStr.length()
, this exception shall throw.- Code:
- Exact Method Body:
NException.check(n, srcStr); LV l = new LV(srcStr, 0, fromIndex, token.length()); int tokenLen = token.length(); for (int i=l.end; i >= 0; i--) if ( srcStr.regionMatches(i, token, 0, tokenLen) && ( (i==0) || Character.isWhitespace(srcStr.charAt(i-1))) && ( ((i + tokenLen) == srcStr.length()) || Character.isWhitespace(srcStr.charAt(i + tokenLen))) ) if (--n == 0) return i; return -1;
-
-