Package Torello.Java
Class StrIndexOf
- java.lang.Object
-
- Torello.Java.StrIndexOf
-
public class StrIndexOf 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.
IndexOfCodeGen.java
This code was developed over two years ago (2020), and has not changed much.This class builds upon the API that is provided byString indexOf
to provide a larger collection of search routines for JavaString's
.
Obviously, Regular-Expressions will always be capable of providing the most powerfulString
-Search and manipulations routines. However, with the extra level of control that a Regular-Expression offers comes some extra-amount of complexity. The routines inclass StrCmpr
andclass StrIndexOf
can eliminatefor-loops
and all the debugging that comes along with them - saving programmers countless hours of when their programs need only simple comparisons and searches that can be written without a RegEx.
Method-Name Nomenclature:first
- This means that the firstString
orchar
match found inside of anotherString
or Sub-Range is returned. Subsequent matches after the first are ignored.
last
- ThisString
orchar
search will begin at the last index in theString
or Sub-Range, and work towards the beginning of thatString
or Sub-Range.
nth
- This will not return the firstString
orchar
match that is identified within the Source-String
, but rather the nth match found.
nthFromEnd
- This will begin the search at the end of the providedString
or Sub-Range, and work towards the beginning. Matches will be then be ignored until the nth match has been identified in thatString
or Sub-Range.
all
- This method will return all matches in the source-String
or Sub-Range.
left
- Searching the inputString
or Sub-Range will begin at a User-Provided index, and work left towards the beginning of the providedString
or Sub-Range. The first match found will be returned.
nthLeft
- - Searching the inputString
or Sub-Range will begin at a User-Provided index, and work left towards the beginning of the providedString
or Sub-Range. Matches will be ignored until the nth match has been identified.
Hi-Lited Source-Code:- View Here: Torello/Java/StrIndexOf.java
- Open New Browser-Tab: Torello/Java/StrIndexOf.java
File Size: 71,796 Bytes Line Count: 1,705 '\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
- 48 Method(s), 48 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 cmpStr)
static int[]
all_CI(String srcStr, char c)
static int[]
all_CI(String srcStr, String cmpStr)
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 cmpStr)
static int[]
all_CI(String srcStr, int sPos, int ePos, char c)
static int[]
all_CI(String srcStr, int sPos, int ePos, String cmpStr)
First Modifier and Type Method static int
first(String srcStr, char c)
static int
first(String srcStr, String cmpStr)
static int
first_CI(String srcStr, char c)
static int
first_CI(String srcStr, String cmpStr)
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 cmpStr)
static int
first_CI(String srcStr, int sPos, int ePos, char c)
static int
first_CI(String srcStr, int sPos, int ePos, String cmpStr)
Last Modifier and Type Method static int
last(String srcStr, char c)
static int
last(String srcStr, String cmpStr)
static int
last_CI(String srcStr, char c)
static int
last_CI(String srcStr, String cmpStr)
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 cmpStr)
static int
last_CI(String srcStr, int sPos, int ePos, char c)
static int
last_CI(String srcStr, int sPos, int ePos, String cmpStr)
Nth Modifier and Type Method static int
nth(String srcStr, int n, char c)
static int
nth(String srcStr, int n, String cmpStr)
static int
nth_CI(String srcStr, int n, char c)
static int
nth_CI(String srcStr, int n, String cmpStr)
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 cmpStr)
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 cmpStr)
Nth-From-End Modifier and Type Method static int
nthFromEnd(String srcStr, int n, char c)
static int
nthFromEnd(String srcStr, int n, String cmpStr)
static int
nthFromEnd_CI(String srcStr, int n, char c)
static int
nthFromEnd_CI(String srcStr, int n, String cmpStr)
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 cmpStr)
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 cmpStr)
Left Modifier and Type Method static int
left(String srcStr, int fromIndex, char c)
static int
left(String srcStr, int fromIndex, String cmpStr)
static int
left_CI(String srcStr, int fromIndex, char c)
static int
left_CI(String srcStr, int fromIndex, String cmpStr)
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 cmpStr)
static int
nthLeft_CI(String srcStr, int fromIndex, int n, char c)
static int
nthLeft_CI(String srcStr, int fromIndex, int n, String cmpStr)
-
-
-
Method Detail
-
all_CI
public static int[] all_CI(java.lang.String srcStr, int sPos, int ePos, char c)
Search for all occurences of character'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
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
. It's contents will be searched for the specified 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. - 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))) 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 cmpStr)
Search for all occurences of substring'cmpStr'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
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
. It's contents will be searched for the specified 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()
cmpStr
- 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. - 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, cmpStr.length()); IntStream.Builder b = IntStream.builder(); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI(java.lang.String srcStr, char c)
Search for all occurences of character'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. It's contents will be searched for the specified 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. - 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))) b.accept(i); return b.build().toArray();
-
all_CI
public static int[] all_CI(java.lang.String srcStr, java.lang.String cmpStr)
Search for all occurences of substring'cmpStr'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
The comparisons performed ** are not ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. It's contents will be searched for the specified matches, and an integer-array ofString
-index pointers will be returned.cmpStr
- 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. - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, cmpStr.length()); IntStream.Builder b = IntStream.builder(); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, int sPos, int ePos, char c)
Search for all occurences of character'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
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
. It's contents will be searched for the specified 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. - 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)) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, int sPos, int ePos, java.lang.String cmpStr)
Search for all occurences of substring'cmpStr'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
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
. It's contents will be searched for the specified 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()
cmpStr
- 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. - 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, cmpStr.length()); IntStream.Builder b = IntStream.builder(); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, char c)
Search for all occurences of character'c'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. It's contents will be searched for the specified 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. - 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)) b.accept(i); return b.build().toArray();
-
all
public static int[] all(java.lang.String srcStr, java.lang.String cmpStr)
Search for all occurences of substring'cmpStr'
in'srcStr'
, and return an integer-array of index-locations into'srcStr.'
The comparisons performed ** are ** case-sensitive- Parameters:
srcStr
- This may be anyjava.lang.String
. It's contents will be searched for the specified matches, and an integer-array ofString
-index pointers will be returned.cmpStr
- 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. - Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, cmpStr.length()); IntStream.Builder b = IntStream.builder(); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) b.accept(i); return b.build().toArray();
-
first_CI
public static int first_CI(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the first occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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
String
index of the first identified sub-string match in'srcStr'
- 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))) return i; return -1;
-
first_CI
public static int first_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String cmpStr)
Search for the first occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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()
cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
first_CI
public static int first_CI(java.lang.String srcStr, char c)
Search for the first occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
- 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))) return i; return -1;
-
first_CI
public static int first_CI(java.lang.String srcStr, java.lang.String cmpStr)
Search for the first occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
first
public static int first(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the first occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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
String
index of the first identified sub-string match in'srcStr'
- 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)) return i; return -1;
-
first
public static int first(java.lang.String srcStr, int sPos, int ePos, java.lang.String cmpStr)
Search for the first occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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()
cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
first
public static int first(java.lang.String srcStr, char c)
Search for the first occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
- 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)) return i; return -1;
-
first
public static int first(java.lang.String srcStr, java.lang.String cmpStr)
Search for the first occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the last occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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
String
index of the last identified sub-string match in'srcStr'
- 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))) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, int sPos, int ePos, java.lang.String cmpStr)
Search for the last occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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()
cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the last identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, char c)
Search for the last occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the last identified sub-string match in'srcStr'
- 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))) return i; return -1;
-
last_CI
public static int last_CI(java.lang.String srcStr, java.lang.String cmpStr)
Search for the last occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the last identified sub-string match in'srcStr'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
last
public static int last(java.lang.String srcStr, int sPos, int ePos, char c)
Search for the last occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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
String
index of the last identified sub-string match in'srcStr'
- 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)) return i; return -1;
-
last
public static int last(java.lang.String srcStr, int sPos, int ePos, java.lang.String cmpStr)
Search for the last occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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()
cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the last identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
last
public static int last(java.lang.String srcStr, char c)
Search for the last occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the last identified sub-string match in'srcStr'
- 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)) return i; return -1;
-
last
public static int last(java.lang.String srcStr, java.lang.String cmpStr)
Search for the last occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the last identified sub-string match in'srcStr'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, -1, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) 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 nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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))) 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 cmpStr)
Search for the nth occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) 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 nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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))) if (--n == 0) return i; return -1;
-
nth_CI
public static int nth_CI(java.lang.String srcStr, int n, java.lang.String cmpStr)
Search for the nth occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) 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 nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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)) 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 cmpStr)
Search for the nth occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i; return -1;
-
nth
public static int nth(java.lang.String srcStr, int n, char c)
Search for the nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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)) if (--n == 0) return i; return -1;
-
nth
public static int nth(java.lang.String srcStr, int n, java.lang.String cmpStr)
Search for the nth occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.start; i < l.end; i++) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) 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 nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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))) 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 cmpStr)
Search for the nth occurence of substring'cmpStr'
, 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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) 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 nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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))) if (--n == 0) return i; return -1;
-
nthFromEnd_CI
public static int nthFromEnd_CI(java.lang.String srcStr, int n, java.lang.String cmpStr)
Search for the nth occurence of substring'cmpStr'
, 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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) 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 nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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)) 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 cmpStr)
Search for the nth occurence of substring'cmpStr'
, 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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd(java.lang.String srcStr, int n, char c)
Search for the nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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)) if (--n == 0) return i; return -1;
-
nthFromEnd
public static int nthFromEnd(java.lang.String srcStr, int n, java.lang.String cmpStr)
Search for the nth occurence of substring'cmpStr'
, 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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.n
- This is the number of matches to skip when searching for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left from the end of'srcStr'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=(l.end-1); i >= l.start; i--) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i; return -1;
-
left_CI
public static int left_CI(java.lang.String srcStr, int fromIndex, char c)
Search for the first occurence of character'c'
, but search left beginning at'srcStr'
position'fromIndex'
. 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
. It's contents will be searched for the specified matches, and an index-pointer as 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
String
index of the first identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- 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))) return i; return -1;
-
left_CI
public static int left_CI(java.lang.String srcStr, int fromIndex, java.lang.String cmpStr)
Search for the first occurence of substring'cmpStr'
, but search left beginning at'srcStr'
position'fromIndex'
. 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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.end; i >= 0; i--) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
left
public static int left(java.lang.String srcStr, int fromIndex, char c)
Search for the first occurence of character'c'
, but search left beginning at'srcStr'
position'fromIndex'
. 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
. It's contents will be searched for the specified matches, and an index-pointer as 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
String
index of the first identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex); for (int i=l.end; i >= 0; i--) if (c == srcStr.charAt(i)) return i; return -1;
-
left
public static int left(java.lang.String srcStr, int fromIndex, java.lang.String cmpStr)
Search for the first occurence of substring'cmpStr'
, but search left beginning at'srcStr'
position'fromIndex'
. 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
. It's contents will be searched for the specified matches, and an index-pointer as an integer will be returned.fromIndex
- This is the right-most index-position in'srcStr'
(*INCLUSIVE*) from where the search shall start.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the first identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- Code:
- Exact Method Body:
LV l = new LV(srcStr, 0, fromIndex, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.end; i >= 0; i--) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i; return -1;
-
nthLeft_CI
public static int nthLeft_CI(java.lang.String srcStr, int fromIndex, int n, char c)
Search for the nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- 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))) 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 cmpStr)
Search for the nth occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.end; i >= 0; i--) if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) 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 nth occurence of character'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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for character'c'
before returning an answer.c
- This is the character that will be 'searched-for' in input-parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- 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)) if (--n == 0) return i; return -1;
-
nthLeft
public static int nthLeft(java.lang.String srcStr, int fromIndex, int n, java.lang.String cmpStr)
Search for the nth occurence of substring'cmpStr'
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
. It's contents will be searched for the specified matches, and an index-pointer as 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 for substring'cmpStr'
before returning an answer.cmpStr
- This is the sub-string that will be 'searched-for' in input parameterString 'srcStr'
.- Returns:
- The
String
index of the nth identified sub-string match in'srcStr'
, counting left in'srcStr'
from position'fromIndex'
- 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, cmpStr.length()); int cmpStrLen = cmpStr.length(); for (int i=l.end; i >= 0; i--) if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i; return -1;
-
-