001package Torello.Java;
002
003import java.util.Vector;
004import java.util.stream.IntStream;
005
006/**
007 * This class builds upon the API that is provided by {@code String indexOf} to provide a
008 * larger collection of search routines for Java {@code String's}.
009 * 
010 * <EMBED CLASS='external-html' DATA-FILE-ID=STR_INDEX_OF>
011 */
012@Torello.JavaDoc.StaticFunctional
013@Torello.JavaDoc.JDHeaderBackgroundImg
014@Torello.JavaDoc.CSSLinks(FileNames="Strings.css")
015public class StrIndexOf
016{
017    private StrIndexOf() { }
018
019    /**
020     * Search for <B STYLE='color: red'>all</B> occurences of character {@code 'c'}
021     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
022     * 
023     * <BR /><BR /><DIV CLASS=JDHint>
024     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
025     * </DIV>
026     * 
027     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
028     * 
029     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
030     * for the specified matches, and an integer-array of {@code String}-index pointers
031     * will be returned.
032     * 
033     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
034     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
035     * 
036     * @param c This is the character that will be 'searched-for' in input-parameter
037     * {@code String 'srcStr'}.
038     * 
039     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
040     * {@code java.lang.String}-indices where matches were found.
041     * 
042     * @throws StringIndexOutOfBoundsException
043     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
044     */
045    public static int[] all_CI(String srcStr, int sPos, int ePos, char c)
046    {
047        LV                  l = new LV(srcStr, sPos, ePos);
048        IntStream.Builder   b = IntStream.builder();
049
050        c = Character.toLowerCase(c);
051
052        for (int i=l.start; i < l.end; i++)
053            if (c == Character.toLowerCase(srcStr.charAt(i))) b.accept(i);
054
055        return b.build().toArray();
056    }
057
058    /**
059     * Search for <B STYLE='color: red'>all</B> occurences of substring {@code 'cmpStr'}
060     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
061     * 
062     * <BR /><BR /><DIV CLASS=JDHint>
063     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
064     * </DIV>
065     * 
066     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
067     * 
068     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
069     * for the specified matches, and an integer-array of {@code String}-index pointers
070     * will be returned.
071     * 
072     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
073     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
074     * 
075     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
076     * {@code String 'srcStr'}.
077     * 
078     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
079     * {@code java.lang.String}-indices where matches were found.
080     * 
081     * @throws StringIndexOutOfBoundsException
082     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
083     */
084    public static int[] all_CI(String srcStr, int sPos, int ePos, String cmpStr)
085    {
086        LV                  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
087        IntStream.Builder   b           = IntStream.builder();
088        int                 cmpStrLen   = cmpStr.length();
089
090        for (int i=l.start; i < l.end; i++)
091            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) b.accept(i);
092
093        return b.build().toArray();
094    }
095
096    /**
097     * Search for <B STYLE='color: red'>all</B> occurences of character {@code 'c'}
098     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
099     * 
100     * <BR /><BR /><DIV CLASS=JDHint>
101     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
102     * </DIV>
103     * 
104     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
105     * for the specified matches, and an integer-array of {@code String}-index pointers
106     * will be returned.
107     * 
108     * @param c This is the character that will be 'searched-for' in input-parameter
109     * {@code String 'srcStr'}.
110     * 
111     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
112     * {@code java.lang.String}-indices where matches were found.
113     */
114    public static int[] all_CI(String srcStr, char c)
115    {
116        LV                  l = new LV(srcStr, 0, -1);
117        IntStream.Builder   b = IntStream.builder();
118
119        c = Character.toLowerCase(c);
120
121        for (int i=l.start; i < l.end; i++)
122            if (c == Character.toLowerCase(srcStr.charAt(i))) b.accept(i);
123
124        return b.build().toArray();
125    }
126
127    /**
128     * Search for <B STYLE='color: red'>all</B> occurences of substring {@code 'cmpStr'}
129     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
130     * 
131     * <BR /><BR /><DIV CLASS=JDHint>
132     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
133     * </DIV>
134     * 
135     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
136     * for the specified matches, and an integer-array of {@code String}-index pointers
137     * will be returned.
138     * 
139     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
140     * {@code String 'srcStr'}.
141     * 
142     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
143     * {@code java.lang.String}-indices where matches were found.
144     */
145    public static int[] all_CI(String srcStr, String cmpStr)
146    {
147        LV                  l           = new LV(srcStr, 0, -1, cmpStr.length());
148        IntStream.Builder   b           = IntStream.builder();
149        int                 cmpStrLen   = cmpStr.length();
150
151        for (int i=l.start; i < l.end; i++)
152            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) b.accept(i);
153
154        return b.build().toArray();
155    }
156
157    /**
158     * Search for <B STYLE='color: red'>all</B> occurences of character {@code 'c'}
159     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
160     * 
161     * <BR /><BR /><DIV CLASS=JDHint>
162     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
163     * </DIV>
164     * 
165     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
166     * 
167     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
168     * for the specified matches, and an integer-array of {@code String}-index pointers
169     * will be returned.
170     * 
171     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
172     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
173     * 
174     * @param c This is the character that will be 'searched-for' in input-parameter
175     * {@code String 'srcStr'}.
176     * 
177     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
178     * {@code java.lang.String}-indices where matches were found.
179     * 
180     * @throws StringIndexOutOfBoundsException
181     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
182     */
183    public static int[] all(String srcStr, int sPos, int ePos, char c)
184    {
185        LV                  l = new LV(srcStr, sPos, ePos);
186        IntStream.Builder   b = IntStream.builder();
187
188        for (int i=l.start; i < l.end; i++)
189            if (c == srcStr.charAt(i)) b.accept(i);
190
191        return b.build().toArray();
192    }
193
194    /**
195     * Search for <B STYLE='color: red'>all</B> occurences of substring {@code 'cmpStr'}
196     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
197     * 
198     * <BR /><BR /><DIV CLASS=JDHint>
199     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
200     * </DIV>
201     * 
202     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
203     * 
204     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
205     * for the specified matches, and an integer-array of {@code String}-index pointers
206     * will be returned.
207     * 
208     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
209     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
210     * 
211     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
212     * {@code String 'srcStr'}.
213     * 
214     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
215     * {@code java.lang.String}-indices where matches were found.
216     * 
217     * @throws StringIndexOutOfBoundsException
218     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
219     */
220    public static int[] all(String srcStr, int sPos, int ePos, String cmpStr)
221    {
222        LV                  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
223        IntStream.Builder   b           = IntStream.builder();
224        int                 cmpStrLen   = cmpStr.length();
225
226        for (int i=l.start; i < l.end; i++)
227            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) b.accept(i);
228
229        return b.build().toArray();
230    }
231
232    /**
233     * Search for <B STYLE='color: red'>all</B> occurences of character {@code 'c'}
234     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
235     * 
236     * <BR /><BR /><DIV CLASS=JDHint>
237     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
238     * </DIV>
239     * 
240     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
241     * for the specified matches, and an integer-array of {@code String}-index pointers
242     * will be returned.
243     * 
244     * @param c This is the character that will be 'searched-for' in input-parameter
245     * {@code String 'srcStr'}.
246     * 
247     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
248     * {@code java.lang.String}-indices where matches were found.
249     */
250    public static int[] all(String srcStr, char c)
251    {
252        LV                  l = new LV(srcStr, 0, -1);
253        IntStream.Builder   b = IntStream.builder();
254
255        for (int i=l.start; i < l.end; i++)
256            if (c == srcStr.charAt(i)) b.accept(i);
257
258        return b.build().toArray();
259    }
260
261    /**
262     * Search for <B STYLE='color: red'>all</B> occurences of substring {@code 'cmpStr'}
263     * in {@code 'srcStr'}, and return an integer-array of index-locations into {@code 'srcStr.'}
264     * 
265     * <BR /><BR /><DIV CLASS=JDHint>
266     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
267     * </DIV>
268     * 
269     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
270     * for the specified matches, and an integer-array of {@code String}-index pointers
271     * will be returned.
272     * 
273     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
274     * {@code String 'srcStr'}.
275     * 
276     * @return An integer-pointer array of <B STYLE='color: red'>all</B>
277     * {@code java.lang.String}-indices where matches were found.
278     */
279    public static int[] all(String srcStr, String cmpStr)
280    {
281        LV                  l           = new LV(srcStr, 0, -1, cmpStr.length());
282        IntStream.Builder   b           = IntStream.builder();
283        int                 cmpStrLen   = cmpStr.length();
284
285        for (int i=l.start; i < l.end; i++)
286            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) b.accept(i);
287
288        return b.build().toArray();
289    }
290
291    /**
292     * Search for the <B STYLE='color: red'>first</B> occurence of character {@code 'c'}
293     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
294     * match occured.
295     * 
296     * <BR /><BR /><DIV CLASS=JDHint>
297     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
298     * </DIV>
299     * 
300     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
301     * 
302     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
303     * for the specified matches, and an index-pointer as an integer will be returned.
304     * 
305     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
306     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
307     * 
308     * @param c This is the character that will be 'searched-for' in input-parameter
309     * {@code String 'srcStr'}.
310     * 
311     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
312     * sub-string match in {@code 'srcStr'}
313     * 
314     * @throws StringIndexOutOfBoundsException
315     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
316     */
317    public static int first_CI(String srcStr, int sPos, int ePos, char c)
318    {
319        LV l = new LV(srcStr, sPos, ePos);
320
321        c = Character.toLowerCase(c);
322
323        for (int i=l.start; i < l.end; i++)
324            if (c == Character.toLowerCase(srcStr.charAt(i))) return i;
325
326        return -1;
327    }
328
329    /**
330     * Search for the <B STYLE='color: red'>first</B> occurence of substring {@code 'cmpStr'}
331     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
332     * match occured.
333     * 
334     * <BR /><BR /><DIV CLASS=JDHint>
335     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
336     * </DIV>
337     * 
338     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
339     * 
340     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
341     * for the specified matches, and an index-pointer as an integer will be returned.
342     * 
343     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
344     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
345     * 
346     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
347     * {@code String 'srcStr'}.
348     * 
349     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
350     * sub-string match in {@code 'srcStr'}
351     * 
352     * @throws StringIndexOutOfBoundsException
353     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
354     */
355    public static int first_CI(String srcStr, int sPos, int ePos, String cmpStr)
356    {
357        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
358        int cmpStrLen   = cmpStr.length();
359
360        for (int i=l.start; i < l.end; i++)
361            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i;
362
363        return -1;
364    }
365
366    /**
367     * Search for the <B STYLE='color: red'>first</B> occurence of character {@code 'c'}
368     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
369     * match occured.
370     * 
371     * <BR /><BR /><DIV CLASS=JDHint>
372     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
373     * </DIV>
374     * 
375     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
376     * for the specified matches, and an index-pointer as an integer will be returned.
377     * 
378     * @param c This is the character that will be 'searched-for' in input-parameter
379     * {@code String 'srcStr'}.
380     * 
381     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
382     * sub-string match in {@code 'srcStr'}
383     */
384    public static int first_CI(String srcStr, char c)
385    {
386        LV l = new LV(srcStr, 0, -1);
387
388        c = Character.toLowerCase(c);
389
390        for (int i=l.start; i < l.end; i++)
391            if (c == Character.toLowerCase(srcStr.charAt(i))) return i;
392
393        return -1;
394    }
395
396    /**
397     * Search for the <B STYLE='color: red'>first</B> occurence of substring {@code 'cmpStr'}
398     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
399     * match occured.
400     * 
401     * <BR /><BR /><DIV CLASS=JDHint>
402     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
403     * </DIV>
404     * 
405     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
406     * for the specified matches, and an index-pointer as an integer will be returned.
407     * 
408     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
409     * {@code String 'srcStr'}.
410     * 
411     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
412     * sub-string match in {@code 'srcStr'}
413     */
414    public static int first_CI(String srcStr, String cmpStr)
415    {
416        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
417        int cmpStrLen   = cmpStr.length();
418
419        for (int i=l.start; i < l.end; i++)
420            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i;
421
422        return -1;
423    }
424
425    /**
426     * Search for the <B STYLE='color: red'>first</B> occurence of character {@code 'c'}
427     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
428     * match occured.
429     * 
430     * <BR /><BR /><DIV CLASS=JDHint>
431     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
432     * </DIV>
433     * 
434     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
435     * 
436     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
437     * for the specified matches, and an index-pointer as an integer will be returned.
438     * 
439     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
440     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
441     * 
442     * @param c This is the character that will be 'searched-for' in input-parameter
443     * {@code String 'srcStr'}.
444     * 
445     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
446     * sub-string match in {@code 'srcStr'}
447     * 
448     * @throws StringIndexOutOfBoundsException
449     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
450     */
451    public static int first(String srcStr, int sPos, int ePos, char c)
452    {
453        LV l = new LV(srcStr, sPos, ePos);
454
455        for (int i=l.start; i < l.end; i++)
456            if (c == srcStr.charAt(i)) return i;
457
458        return -1;
459    }
460
461    /**
462     * Search for the <B STYLE='color: red'>first</B> occurence of substring {@code 'cmpStr'}
463     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
464     * match occured.
465     * 
466     * <BR /><BR /><DIV CLASS=JDHint>
467     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
468     * </DIV>
469     * 
470     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
471     * 
472     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
473     * for the specified matches, and an index-pointer as an integer will be returned.
474     * 
475     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
476     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
477     * 
478     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
479     * {@code String 'srcStr'}.
480     * 
481     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
482     * sub-string match in {@code 'srcStr'}
483     * 
484     * @throws StringIndexOutOfBoundsException
485     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
486     */
487    public static int first(String srcStr, int sPos, int ePos, String cmpStr)
488    {
489        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
490        int cmpStrLen   = cmpStr.length();
491
492        for (int i=l.start; i < l.end; i++)
493            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i;
494
495        return -1;
496    }
497
498    /**
499     * Search for the <B STYLE='color: red'>first</B> occurence of character {@code 'c'}
500     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
501     * match occured.
502     * 
503     * <BR /><BR /><DIV CLASS=JDHint>
504     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
505     * </DIV>
506     * 
507     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
508     * for the specified matches, and an index-pointer as an integer will be returned.
509     * 
510     * @param c This is the character that will be 'searched-for' in input-parameter
511     * {@code String 'srcStr'}.
512     * 
513     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
514     * sub-string match in {@code 'srcStr'}
515     */
516    public static int first(String srcStr, char c)
517    {
518        LV l = new LV(srcStr, 0, -1);
519
520        for (int i=l.start; i < l.end; i++)
521            if (c == srcStr.charAt(i)) return i;
522
523        return -1;
524    }
525
526    /**
527     * Search for the <B STYLE='color: red'>first</B> occurence of substring {@code 'cmpStr'}
528     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
529     * match occured.
530     * 
531     * <BR /><BR /><DIV CLASS=JDHint>
532     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
533     * </DIV>
534     * 
535     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
536     * for the specified matches, and an index-pointer as an integer will be returned.
537     * 
538     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
539     * {@code String 'srcStr'}.
540     * 
541     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
542     * sub-string match in {@code 'srcStr'}
543     */
544    public static int first(String srcStr, String cmpStr)
545    {
546        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
547        int cmpStrLen   = cmpStr.length();
548
549        for (int i=l.start; i < l.end; i++)
550            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i;
551
552        return -1;
553    }
554
555    /**
556     * Search for the <B STYLE='color: red'>last</B> occurence of character {@code 'c'}
557     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
558     * match occured.
559     * 
560     * <BR /><BR /><DIV CLASS=JDHint>
561     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
562     * </DIV>
563     * 
564     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
565     * 
566     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
567     * for the specified matches, and an index-pointer as an integer will be returned.
568     * 
569     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
570     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
571     * 
572     * @param c This is the character that will be 'searched-for' in input-parameter
573     * {@code String 'srcStr'}.
574     * 
575     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
576     * sub-string match in {@code 'srcStr'}
577     * 
578     * @throws StringIndexOutOfBoundsException
579     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
580     */
581    public static int last_CI(String srcStr, int sPos, int ePos, char c)
582    {
583        LV l = new LV(srcStr, sPos, ePos);
584
585        c = Character.toLowerCase(c);
586
587        for (int i=(l.end-1); i >= l.start; i--)
588            if (c == Character.toLowerCase(srcStr.charAt(i))) return i;
589
590        return -1;
591    }
592
593    /**
594     * Search for the <B STYLE='color: red'>last</B> occurence of substring {@code 'cmpStr'}
595     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
596     * match occured.
597     * 
598     * <BR /><BR /><DIV CLASS=JDHint>
599     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
600     * </DIV>
601     * 
602     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
603     * 
604     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
605     * for the specified matches, and an index-pointer as an integer will be returned.
606     * 
607     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
608     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
609     * 
610     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
611     * {@code String 'srcStr'}.
612     * 
613     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
614     * sub-string match in {@code 'srcStr'}
615     * 
616     * @throws StringIndexOutOfBoundsException
617     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
618     */
619    public static int last_CI(String srcStr, int sPos, int ePos, String cmpStr)
620    {
621        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
622        int cmpStrLen   = cmpStr.length();
623
624        for (int i=(l.end-1); i >= l.start; i--)
625            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i;
626
627        return -1;
628    }
629
630    /**
631     * Search for the <B STYLE='color: red'>last</B> occurence of character {@code 'c'}
632     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
633     * match occured.
634     * 
635     * <BR /><BR /><DIV CLASS=JDHint>
636     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
637     * </DIV>
638     * 
639     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
640     * for the specified matches, and an index-pointer as an integer will be returned.
641     * 
642     * @param c This is the character that will be 'searched-for' in input-parameter
643     * {@code String 'srcStr'}.
644     * 
645     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
646     * sub-string match in {@code 'srcStr'}
647     */
648    public static int last_CI(String srcStr, char c)
649    {
650        LV l = new LV(srcStr, 0, -1);
651
652        c = Character.toLowerCase(c);
653
654        for (int i=(l.end-1); i >= l.start; i--)
655            if (c == Character.toLowerCase(srcStr.charAt(i))) return i;
656
657        return -1;
658    }
659
660    /**
661     * Search for the <B STYLE='color: red'>last</B> occurence of substring {@code 'cmpStr'}
662     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
663     * match occured.
664     * 
665     * <BR /><BR /><DIV CLASS=JDHint>
666     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
667     * </DIV>
668     * 
669     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
670     * for the specified matches, and an index-pointer as an integer will be returned.
671     * 
672     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
673     * {@code String 'srcStr'}.
674     * 
675     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
676     * sub-string match in {@code 'srcStr'}
677     */
678    public static int last_CI(String srcStr, String cmpStr)
679    {
680        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
681        int cmpStrLen   = cmpStr.length();
682
683        for (int i=(l.end-1); i >= l.start; i--)
684            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i;
685
686        return -1;
687    }
688
689    /**
690     * Search for the <B STYLE='color: red'>last</B> occurence of character {@code 'c'}
691     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
692     * match occured.
693     * 
694     * <BR /><BR /><DIV CLASS=JDHint>
695     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
696     * </DIV>
697     * 
698     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
699     * 
700     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
701     * for the specified matches, and an index-pointer as an integer will be returned.
702     * 
703     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
704     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
705     * 
706     * @param c This is the character that will be 'searched-for' in input-parameter
707     * {@code String 'srcStr'}.
708     * 
709     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
710     * sub-string match in {@code 'srcStr'}
711     * 
712     * @throws StringIndexOutOfBoundsException
713     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
714     */
715    public static int last(String srcStr, int sPos, int ePos, char c)
716    {
717        LV l = new LV(srcStr, sPos, ePos);
718
719        for (int i=(l.end-1); i >= l.start; i--)
720            if (c == srcStr.charAt(i)) return i;
721
722        return -1;
723    }
724
725    /**
726     * Search for the <B STYLE='color: red'>last</B> occurence of substring {@code 'cmpStr'}
727     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
728     * match occured.
729     * 
730     * <BR /><BR /><DIV CLASS=JDHint>
731     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
732     * </DIV>
733     * 
734     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
735     * 
736     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
737     * for the specified matches, and an index-pointer as an integer will be returned.
738     * 
739     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
740     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
741     * 
742     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
743     * {@code String 'srcStr'}.
744     * 
745     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
746     * sub-string match in {@code 'srcStr'}
747     * 
748     * @throws StringIndexOutOfBoundsException
749     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
750     */
751    public static int last(String srcStr, int sPos, int ePos, String cmpStr)
752    {
753        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
754        int cmpStrLen   = cmpStr.length();
755
756        for (int i=(l.end-1); i >= l.start; i--)
757            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i;
758
759        return -1;
760    }
761
762    /**
763     * Search for the <B STYLE='color: red'>last</B> occurence of character {@code 'c'}
764     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
765     * match occured.
766     * 
767     * <BR /><BR /><DIV CLASS=JDHint>
768     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
769     * </DIV>
770     * 
771     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
772     * for the specified matches, and an index-pointer as an integer will be returned.
773     * 
774     * @param c This is the character that will be 'searched-for' in input-parameter
775     * {@code String 'srcStr'}.
776     * 
777     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
778     * sub-string match in {@code 'srcStr'}
779     */
780    public static int last(String srcStr, char c)
781    {
782        LV l = new LV(srcStr, 0, -1);
783
784        for (int i=(l.end-1); i >= l.start; i--)
785            if (c == srcStr.charAt(i)) return i;
786
787        return -1;
788    }
789
790    /**
791     * Search for the <B STYLE='color: red'>last</B> occurence of substring {@code 'cmpStr'}
792     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
793     * match occured.
794     * 
795     * <BR /><BR /><DIV CLASS=JDHint>
796     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
797     * </DIV>
798     * 
799     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
800     * for the specified matches, and an index-pointer as an integer will be returned.
801     * 
802     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
803     * {@code String 'srcStr'}.
804     * 
805     * @return The {@code String} index of the <B STYLE='color: red'>last</B> identified
806     * sub-string match in {@code 'srcStr'}
807     */
808    public static int last(String srcStr, String cmpStr)
809    {
810        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
811        int cmpStrLen   = cmpStr.length();
812
813        for (int i=(l.end-1); i >= l.start; i--)
814            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i;
815
816        return -1;
817    }
818
819    /**
820     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}
821     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
822     * match occured.
823     * 
824     * <BR /><BR /><DIV CLASS=JDHint>
825     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
826     * </DIV>
827     * 
828     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
829     * 
830     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
831     * for the specified matches, and an index-pointer as an integer will be returned.
832     * 
833     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
834     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
835     * 
836     * @param n This is the number of matches to skip when searching for character {@code 'c'}
837     * before returning an answer.
838     * 
839     * @param c This is the character that will be 'searched-for' in input-parameter
840     * {@code String 'srcStr'}.
841     * 
842     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
843     * match in {@code 'srcStr'}
844     * 
845     * @throws StringIndexOutOfBoundsException
846     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
847     * 
848     * @throws NException If the value of {@code 'n'} is negative, or greater than
849     * {@code srcStr.length()}, this exception shall throw.
850     */
851    public static int nth_CI(String srcStr, int sPos, int ePos, int n, char c)
852    {
853        NException.check(n, srcStr);
854
855        LV l = new LV(srcStr, sPos, ePos);
856
857        c = Character.toLowerCase(c);
858
859        for (int i=l.start; i < l.end; i++)
860            if (c == Character.toLowerCase(srcStr.charAt(i))) if (--n == 0) return i;
861
862        return -1;
863    }
864
865    /**
866     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}
867     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
868     * match occured.
869     * 
870     * <BR /><BR /><DIV CLASS=JDHint>
871     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
872     * </DIV>
873     * 
874     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
875     * 
876     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
877     * for the specified matches, and an index-pointer as an integer will be returned.
878     * 
879     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
880     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
881     * 
882     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
883     * before returning an answer.
884     * 
885     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
886     * {@code String 'srcStr'}.
887     * 
888     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
889     * match in {@code 'srcStr'}
890     * 
891     * @throws StringIndexOutOfBoundsException
892     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
893     * 
894     * @throws NException If the value of {@code 'n'} is negative, or greater than
895     * {@code srcStr.length()}, this exception shall throw.
896     */
897    public static int nth_CI(String srcStr, int sPos, int ePos, int n, String cmpStr)
898    {
899        NException.check(n, srcStr);
900
901        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
902        int cmpStrLen   = cmpStr.length();
903
904        for (int i=l.start; i < l.end; i++)
905            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
906
907        return -1;
908    }
909
910    /**
911     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}
912     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
913     * match occured.
914     * 
915     * <BR /><BR /><DIV CLASS=JDHint>
916     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
917     * </DIV>
918     * 
919     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
920     * for the specified matches, and an index-pointer as an integer will be returned.
921     * 
922     * @param n This is the number of matches to skip when searching for character {@code 'c'}
923     * before returning an answer.
924     * 
925     * @param c This is the character that will be 'searched-for' in input-parameter
926     * {@code String 'srcStr'}.
927     * 
928     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
929     * match in {@code 'srcStr'}
930     * 
931     * @throws NException If the value of {@code 'n'} is negative, or greater than
932     * {@code srcStr.length()}, this exception shall throw.
933     */
934    public static int nth_CI(String srcStr, int n, char c)
935    {
936        NException.check(n, srcStr);
937
938        LV l = new LV(srcStr, 0, -1);
939
940        c = Character.toLowerCase(c);
941
942        for (int i=l.start; i < l.end; i++)
943            if (c == Character.toLowerCase(srcStr.charAt(i))) if (--n == 0) return i;
944
945        return -1;
946    }
947
948    /**
949     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}
950     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
951     * match occured.
952     * 
953     * <BR /><BR /><DIV CLASS=JDHint>
954     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
955     * </DIV>
956     * 
957     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
958     * for the specified matches, and an index-pointer as an integer will be returned.
959     * 
960     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
961     * before returning an answer.
962     * 
963     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
964     * {@code String 'srcStr'}.
965     * 
966     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
967     * match in {@code 'srcStr'}
968     * 
969     * @throws NException If the value of {@code 'n'} is negative, or greater than
970     * {@code srcStr.length()}, this exception shall throw.
971     */
972    public static int nth_CI(String srcStr, int n, String cmpStr)
973    {
974        NException.check(n, srcStr);
975
976        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
977        int cmpStrLen   = cmpStr.length();
978
979        for (int i=l.start; i < l.end; i++)
980            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
981
982        return -1;
983    }
984
985    /**
986     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}
987     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
988     * match occured.
989     * 
990     * <BR /><BR /><DIV CLASS=JDHint>
991     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
992     * </DIV>
993     * 
994     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
995     * 
996     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
997     * for the specified matches, and an index-pointer as an integer will be returned.
998     * 
999     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
1000     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
1001     * 
1002     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1003     * before returning an answer.
1004     * 
1005     * @param c This is the character that will be 'searched-for' in input-parameter
1006     * {@code String 'srcStr'}.
1007     * 
1008     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1009     * match in {@code 'srcStr'}
1010     * 
1011     * @throws StringIndexOutOfBoundsException
1012     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
1013     * 
1014     * @throws NException If the value of {@code 'n'} is negative, or greater than
1015     * {@code srcStr.length()}, this exception shall throw.
1016     */
1017    public static int nth(String srcStr, int sPos, int ePos, int n, char c)
1018    {
1019        NException.check(n, srcStr);
1020
1021        LV l = new LV(srcStr, sPos, ePos);
1022
1023        for (int i=l.start; i < l.end; i++)
1024            if (c == srcStr.charAt(i)) if (--n == 0) return i;
1025
1026        return -1;
1027    }
1028
1029    /**
1030     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}
1031     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
1032     * match occured.
1033     * 
1034     * <BR /><BR /><DIV CLASS=JDHint>
1035     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1036     * </DIV>
1037     * 
1038     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
1039     * 
1040     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1041     * for the specified matches, and an index-pointer as an integer will be returned.
1042     * 
1043     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
1044     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
1045     * 
1046     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1047     * before returning an answer.
1048     * 
1049     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1050     * {@code String 'srcStr'}.
1051     * 
1052     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1053     * match in {@code 'srcStr'}
1054     * 
1055     * @throws StringIndexOutOfBoundsException
1056     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
1057     * 
1058     * @throws NException If the value of {@code 'n'} is negative, or greater than
1059     * {@code srcStr.length()}, this exception shall throw.
1060     */
1061    public static int nth(String srcStr, int sPos, int ePos, int n, String cmpStr)
1062    {
1063        NException.check(n, srcStr);
1064
1065        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
1066        int cmpStrLen   = cmpStr.length();
1067
1068        for (int i=l.start; i < l.end; i++)
1069            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1070
1071        return -1;
1072    }
1073
1074    /**
1075     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}
1076     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
1077     * match occured.
1078     * 
1079     * <BR /><BR /><DIV CLASS=JDHint>
1080     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1081     * </DIV>
1082     * 
1083     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1084     * for the specified matches, and an index-pointer as an integer will be returned.
1085     * 
1086     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1087     * before returning an answer.
1088     * 
1089     * @param c This is the character that will be 'searched-for' in input-parameter
1090     * {@code String 'srcStr'}.
1091     * 
1092     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1093     * match in {@code 'srcStr'}
1094     * 
1095     * @throws NException If the value of {@code 'n'} is negative, or greater than
1096     * {@code srcStr.length()}, this exception shall throw.
1097     */
1098    public static int nth(String srcStr, int n, char c)
1099    {
1100        NException.check(n, srcStr);
1101
1102        LV l = new LV(srcStr, 0, -1);
1103
1104        for (int i=l.start; i < l.end; i++)
1105            if (c == srcStr.charAt(i)) if (--n == 0) return i;
1106
1107        return -1;
1108    }
1109
1110    /**
1111     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}
1112     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
1113     * match occured.
1114     * 
1115     * <BR /><BR /><DIV CLASS=JDHint>
1116     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1117     * </DIV>
1118     * 
1119     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1120     * for the specified matches, and an index-pointer as an integer will be returned.
1121     * 
1122     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1123     * before returning an answer.
1124     * 
1125     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1126     * {@code String 'srcStr'}.
1127     * 
1128     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1129     * match in {@code 'srcStr'}
1130     * 
1131     * @throws NException If the value of {@code 'n'} is negative, or greater than
1132     * {@code srcStr.length()}, this exception shall throw.
1133     */
1134    public static int nth(String srcStr, int n, String cmpStr)
1135    {
1136        NException.check(n, srcStr);
1137
1138        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
1139        int cmpStrLen   = cmpStr.length();
1140
1141        for (int i=l.start; i < l.end; i++)
1142            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1143
1144        return -1;
1145    }
1146
1147    /**
1148     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}, but
1149     * start the search with the <I>last character of the String and work
1150     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1151     * where the match occured.
1152     * 
1153     * <BR /><BR /><DIV CLASS=JDHint>
1154     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1155     * </DIV>
1156     * 
1157     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
1158     * 
1159     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1160     * for the specified matches, and an index-pointer as an integer will be returned.
1161     * 
1162     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
1163     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
1164     * 
1165     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1166     * before returning an answer.
1167     * 
1168     * @param c This is the character that will be 'searched-for' in input-parameter
1169     * {@code String 'srcStr'}.
1170     * 
1171     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1172     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1173     * {@code 'srcStr'}</I>
1174     * 
1175     * @throws StringIndexOutOfBoundsException
1176     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
1177     * 
1178     * @throws NException If the value of {@code 'n'} is negative, or greater than
1179     * {@code srcStr.length()}, this exception shall throw.
1180     */
1181    public static int nthFromEnd_CI(String srcStr, int sPos, int ePos, int n, char c)
1182    {
1183        NException.check(n, srcStr);
1184
1185        LV l = new LV(srcStr, sPos, ePos);
1186
1187        c = Character.toLowerCase(c);
1188
1189        for (int i=(l.end-1); i >= l.start; i--)
1190            if (c == Character.toLowerCase(srcStr.charAt(i))) if (--n == 0) return i;
1191
1192        return -1;
1193    }
1194
1195    /**
1196     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}, but
1197     * start the search with the <I>last character of the String and work
1198     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1199     * where the match occured.
1200     * 
1201     * <BR /><BR /><DIV CLASS=JDHint>
1202     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1203     * </DIV>
1204     * 
1205     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
1206     * 
1207     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1208     * for the specified matches, and an index-pointer as an integer will be returned.
1209     * 
1210     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
1211     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
1212     * 
1213     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1214     * before returning an answer.
1215     * 
1216     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1217     * {@code String 'srcStr'}.
1218     * 
1219     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1220     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1221     * {@code 'srcStr'}</I>
1222     * 
1223     * @throws StringIndexOutOfBoundsException
1224     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
1225     * 
1226     * @throws NException If the value of {@code 'n'} is negative, or greater than
1227     * {@code srcStr.length()}, this exception shall throw.
1228     */
1229    public static int nthFromEnd_CI(String srcStr, int sPos, int ePos, int n, String cmpStr)
1230    {
1231        NException.check(n, srcStr);
1232
1233        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
1234        int cmpStrLen   = cmpStr.length();
1235
1236        for (int i=(l.end-1); i >= l.start; i--)
1237            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1238
1239        return -1;
1240    }
1241
1242    /**
1243     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}, but
1244     * start the search with the <I>last character of the String and work
1245     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1246     * where the match occured.
1247     * 
1248     * <BR /><BR /><DIV CLASS=JDHint>
1249     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1250     * </DIV>
1251     * 
1252     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1253     * for the specified matches, and an index-pointer as an integer will be returned.
1254     * 
1255     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1256     * before returning an answer.
1257     * 
1258     * @param c This is the character that will be 'searched-for' in input-parameter
1259     * {@code String 'srcStr'}.
1260     * 
1261     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1262     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1263     * {@code 'srcStr'}</I>
1264     * 
1265     * @throws NException If the value of {@code 'n'} is negative, or greater than
1266     * {@code srcStr.length()}, this exception shall throw.
1267     */
1268    public static int nthFromEnd_CI(String srcStr, int n, char c)
1269    {
1270        NException.check(n, srcStr);
1271
1272        LV l = new LV(srcStr, 0, -1);
1273
1274        c = Character.toLowerCase(c);
1275
1276        for (int i=(l.end-1); i >= l.start; i--)
1277            if (c == Character.toLowerCase(srcStr.charAt(i))) if (--n == 0) return i;
1278
1279        return -1;
1280    }
1281
1282    /**
1283     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}, but
1284     * start the search with the <I>last character of the String and work
1285     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1286     * where the match occured.
1287     * 
1288     * <BR /><BR /><DIV CLASS=JDHint>
1289     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1290     * </DIV>
1291     * 
1292     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1293     * for the specified matches, and an index-pointer as an integer will be returned.
1294     * 
1295     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1296     * before returning an answer.
1297     * 
1298     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1299     * {@code String 'srcStr'}.
1300     * 
1301     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1302     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1303     * {@code 'srcStr'}</I>
1304     * 
1305     * @throws NException If the value of {@code 'n'} is negative, or greater than
1306     * {@code srcStr.length()}, this exception shall throw.
1307     */
1308    public static int nthFromEnd_CI(String srcStr, int n, String cmpStr)
1309    {
1310        NException.check(n, srcStr);
1311
1312        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
1313        int cmpStrLen   = cmpStr.length();
1314
1315        for (int i=(l.end-1); i >= l.start; i--)
1316            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1317
1318        return -1;
1319    }
1320
1321    /**
1322     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}, but
1323     * start the search with the <I>last character of the String and work
1324     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1325     * where the match occured.
1326     * 
1327     * <BR /><BR /><DIV CLASS=JDHint>
1328     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1329     * </DIV>
1330     * 
1331     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
1332     * 
1333     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1334     * for the specified matches, and an index-pointer as an integer will be returned.
1335     * 
1336     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
1337     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
1338     * 
1339     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1340     * before returning an answer.
1341     * 
1342     * @param c This is the character that will be 'searched-for' in input-parameter
1343     * {@code String 'srcStr'}.
1344     * 
1345     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1346     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1347     * {@code 'srcStr'}</I>
1348     * 
1349     * @throws StringIndexOutOfBoundsException
1350     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
1351     * 
1352     * @throws NException If the value of {@code 'n'} is negative, or greater than
1353     * {@code srcStr.length()}, this exception shall throw.
1354     */
1355    public static int nthFromEnd(String srcStr, int sPos, int ePos, int n, char c)
1356    {
1357        NException.check(n, srcStr);
1358
1359        LV l = new LV(srcStr, sPos, ePos);
1360
1361        for (int i=(l.end-1); i >= l.start; i--)
1362            if (c == srcStr.charAt(i)) if (--n == 0) return i;
1363
1364        return -1;
1365    }
1366
1367    /**
1368     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}, but
1369     * start the search with the <I>last character of the String and work
1370     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1371     * where the match occured.
1372     * 
1373     * <BR /><BR /><DIV CLASS=JDHint>
1374     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1375     * </DIV>
1376     * 
1377     * <EMBED CLASS='external-html' DATA-FILE-ID=STIO_SUBSECT>
1378     * 
1379     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1380     * for the specified matches, and an index-pointer as an integer will be returned.
1381     * 
1382     * @param sPos <EMBED CLASS='external-html' DATA-FILE-ID=SPOSSTR>
1383     * @param ePos <EMBED CLASS='external-html' DATA-FILE-ID=EPOSSTR>
1384     * 
1385     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1386     * before returning an answer.
1387     * 
1388     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1389     * {@code String 'srcStr'}.
1390     * 
1391     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1392     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1393     * {@code 'srcStr'}</I>
1394     * 
1395     * @throws StringIndexOutOfBoundsException
1396     * <EMBED CLASS='external-html' DATA-FILE-ID=SIOOB_EX>
1397     * 
1398     * @throws NException If the value of {@code 'n'} is negative, or greater than
1399     * {@code srcStr.length()}, this exception shall throw.
1400     */
1401    public static int nthFromEnd(String srcStr, int sPos, int ePos, int n, String cmpStr)
1402    {
1403        NException.check(n, srcStr);
1404
1405        LV  l           = new LV(srcStr, sPos, ePos, cmpStr.length());
1406        int cmpStrLen   = cmpStr.length();
1407
1408        for (int i=(l.end-1); i >= l.start; i--)
1409            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1410
1411        return -1;
1412    }
1413
1414    /**
1415     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'}, but
1416     * start the search with the <I>last character of the String and work
1417     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1418     * where the match occured.
1419     * 
1420     * <BR /><BR /><DIV CLASS=JDHint>
1421     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1422     * </DIV>
1423     * 
1424     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1425     * for the specified matches, and an index-pointer as an integer will be returned.
1426     * 
1427     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1428     * before returning an answer.
1429     * 
1430     * @param c This is the character that will be 'searched-for' in input-parameter
1431     * {@code String 'srcStr'}.
1432     * 
1433     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1434     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1435     * {@code 'srcStr'}</I>
1436     * 
1437     * @throws NException If the value of {@code 'n'} is negative, or greater than
1438     * {@code srcStr.length()}, this exception shall throw.
1439     */
1440    public static int nthFromEnd(String srcStr, int n, char c)
1441    {
1442        NException.check(n, srcStr);
1443
1444        LV l = new LV(srcStr, 0, -1);
1445
1446        for (int i=(l.end-1); i >= l.start; i--)
1447            if (c == srcStr.charAt(i)) if (--n == 0) return i;
1448
1449        return -1;
1450    }
1451
1452    /**
1453     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'}, but
1454     * start the search with the <I>last character of the String and work
1455     * <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into {@code 'srcStr'}
1456     * where the match occured.
1457     * 
1458     * <BR /><BR /><DIV CLASS=JDHint>
1459     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1460     * </DIV>
1461     * 
1462     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1463     * for the specified matches, and an index-pointer as an integer will be returned.
1464     * 
1465     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1466     * before returning an answer.
1467     * 
1468     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1469     * {@code String 'srcStr'}.
1470     * 
1471     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1472     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> from the end of
1473     * {@code 'srcStr'}</I>
1474     * 
1475     * @throws NException If the value of {@code 'n'} is negative, or greater than
1476     * {@code srcStr.length()}, this exception shall throw.
1477     */
1478    public static int nthFromEnd(String srcStr, int n, String cmpStr)
1479    {
1480        NException.check(n, srcStr);
1481
1482        LV  l           = new LV(srcStr, 0, -1, cmpStr.length());
1483        int cmpStrLen   = cmpStr.length();
1484
1485        for (int i=(l.end-1); i >= l.start; i--)
1486            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1487
1488        return -1;
1489    }
1490
1491    /**
1492     * Search for the <B STYLE='color: red'>first</B> occurence of character {@code 'c'}
1493     * , but <I>search <B STYLE='color: red'>left</B> beginning at {@code 'srcStr'} position
1494     * {@code 'fromIndex'}</I>.
1495
1496     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
1497     * match occured.
1498     * 
1499     * <BR /><BR /><DIV CLASS=JDHint>
1500     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1501     * </DIV>
1502     * 
1503     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1504     * for the specified matches, and an index-pointer as an integer will be returned.
1505     * 
1506     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1507     * from where the search shall start.
1508     * 
1509     * @param c This is the character that will be 'searched-for' in input-parameter
1510     * {@code String 'srcStr'}.
1511     * 
1512     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
1513     * sub-string match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B>
1514     * in {@code 'srcStr'} from position {@code 'fromIndex'}</I>
1515     */
1516    public static int left_CI(String srcStr, int fromIndex, char c)
1517    {
1518        LV l = new LV(srcStr, 0, fromIndex);
1519
1520        c = Character.toLowerCase(c);
1521
1522        for (int i=l.end; i >= 0; i--)
1523            if (c == Character.toLowerCase(srcStr.charAt(i))) return i;
1524
1525        return -1;
1526    }
1527
1528    /**
1529     * Search for the <B STYLE='color: red'>first</B> occurence of substring {@code 'cmpStr'}
1530     * , but <I>search <B STYLE='color: red'>left</B> beginning at {@code 'srcStr'} position
1531     * {@code 'fromIndex'}</I>.
1532
1533     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
1534     * match occured.
1535     * 
1536     * <BR /><BR /><DIV CLASS=JDHint>
1537     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1538     * </DIV>
1539     * 
1540     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1541     * for the specified matches, and an index-pointer as an integer will be returned.
1542     * 
1543     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1544     * from where the search shall start.
1545     * 
1546     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1547     * {@code String 'srcStr'}.
1548     * 
1549     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
1550     * sub-string match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B>
1551     * in {@code 'srcStr'} from position {@code 'fromIndex'}</I>
1552     */
1553    public static int left_CI(String srcStr, int fromIndex, String cmpStr)
1554    {
1555        LV  l           = new LV(srcStr, 0, fromIndex, cmpStr.length());
1556        int cmpStrLen   = cmpStr.length();
1557
1558        for (int i=l.end; i >= 0; i--)
1559            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) return i;
1560
1561        return -1;
1562    }
1563
1564    /**
1565     * Search for the <B STYLE='color: red'>first</B> occurence of character {@code 'c'}
1566     * , but <I>search <B STYLE='color: red'>left</B> beginning at {@code 'srcStr'} position
1567     * {@code 'fromIndex'}</I>.
1568
1569     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
1570     * match occured.
1571     * 
1572     * <BR /><BR /><DIV CLASS=JDHint>
1573     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1574     * </DIV>
1575     * 
1576     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1577     * for the specified matches, and an index-pointer as an integer will be returned.
1578     * 
1579     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1580     * from where the search shall start.
1581     * 
1582     * @param c This is the character that will be 'searched-for' in input-parameter
1583     * {@code String 'srcStr'}.
1584     * 
1585     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
1586     * sub-string match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B>
1587     * in {@code 'srcStr'} from position {@code 'fromIndex'}</I>
1588     */
1589    public static int left(String srcStr, int fromIndex, char c)
1590    {
1591        LV l = new LV(srcStr, 0, fromIndex);
1592
1593        for (int i=l.end; i >= 0; i--)
1594            if (c == srcStr.charAt(i)) return i;
1595
1596        return -1;
1597    }
1598
1599    /**
1600     * Search for the <B STYLE='color: red'>first</B> occurence of substring {@code 'cmpStr'}
1601     * , but <I>search <B STYLE='color: red'>left</B> beginning at {@code 'srcStr'} position
1602     * {@code 'fromIndex'}</I>.
1603
1604     * in {@code 'srcStr'}, and return the integer index-location into {@code 'srcStr'} where the
1605     * match occured.
1606     * 
1607     * <BR /><BR /><DIV CLASS=JDHint>
1608     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1609     * </DIV>
1610     * 
1611     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1612     * for the specified matches, and an index-pointer as an integer will be returned.
1613     * 
1614     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1615     * from where the search shall start.
1616     * 
1617     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1618     * {@code String 'srcStr'}.
1619     * 
1620     * @return The {@code String} index of the <B STYLE='color: red'>first</B> identified
1621     * sub-string match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B>
1622     * in {@code 'srcStr'} from position {@code 'fromIndex'}</I>
1623     */
1624    public static int left(String srcStr, int fromIndex, String cmpStr)
1625    {
1626        LV  l           = new LV(srcStr, 0, fromIndex, cmpStr.length());
1627        int cmpStrLen   = cmpStr.length();
1628
1629        for (int i=l.end; i >= 0; i--)
1630            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) return i;
1631
1632        return -1;
1633    }
1634
1635    /**
1636     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'} in
1637     * {@code 'srcStr'}, but <I>begin the search at index-position {@code 'fromIndex'}
1638     * and work <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into
1639     * {@code 'srcStr'} where the match occured.
1640     * 
1641     * <BR /><BR /><DIV CLASS=JDHint>
1642     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1643     * </DIV>
1644     * 
1645     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1646     * for the specified matches, and an index-pointer as an integer will be returned.
1647     * 
1648     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1649     * from where the search shall start.
1650     * 
1651     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1652     * before returning an answer.
1653     * 
1654     * @param c This is the character that will be 'searched-for' in input-parameter
1655     * {@code String 'srcStr'}.
1656     * 
1657     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1658     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> in {@code 'srcStr'}
1659     * from position {@code 'fromIndex'}</I>
1660     * 
1661     * @throws NException If the value of {@code 'n'} is negative, or greater than
1662     * {@code srcStr.length()}, this exception shall throw.
1663     */
1664    public static int nthLeft_CI(String srcStr, int fromIndex, int n, char c)
1665    {
1666        NException.check(n, srcStr);
1667
1668        LV l = new LV(srcStr, 0, fromIndex);
1669
1670        c = Character.toLowerCase(c);
1671
1672        for (int i=l.end; i >= 0; i--)
1673            if (c == Character.toLowerCase(srcStr.charAt(i))) if (--n == 0) return i;
1674
1675        return -1;
1676    }
1677
1678    /**
1679     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'} in
1680     * {@code 'srcStr'}, but <I>begin the search at index-position {@code 'fromIndex'}
1681     * and work <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into
1682     * {@code 'srcStr'} where the match occured.
1683     * 
1684     * <BR /><BR /><DIV CLASS=JDHint>
1685     * The comparisons performed <B STYLE='color: red'>** are not **</B> case-sensitive
1686     * </DIV>
1687     * 
1688     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1689     * for the specified matches, and an index-pointer as an integer will be returned.
1690     * 
1691     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1692     * from where the search shall start.
1693     * 
1694     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1695     * before returning an answer.
1696     * 
1697     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1698     * {@code String 'srcStr'}.
1699     * 
1700     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1701     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> in {@code 'srcStr'}
1702     * from position {@code 'fromIndex'}</I>
1703     * 
1704     * @throws NException If the value of {@code 'n'} is negative, or greater than
1705     * {@code srcStr.length()}, this exception shall throw.
1706     */
1707    public static int nthLeft_CI(String srcStr, int fromIndex, int n, String cmpStr)
1708    {
1709        NException.check(n, srcStr);
1710
1711        LV  l           = new LV(srcStr, 0, fromIndex, cmpStr.length());
1712        int cmpStrLen   = cmpStr.length();
1713
1714        for (int i=l.end; i >= 0; i--)
1715            if (srcStr.regionMatches(true, i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1716
1717        return -1;
1718    }
1719
1720    /**
1721     * Search for the <B STYLE='color: red'>nth</B> occurence of character {@code 'c'} in
1722     * {@code 'srcStr'}, but <I>begin the search at index-position {@code 'fromIndex'}
1723     * and work <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into
1724     * {@code 'srcStr'} where the match occured.
1725     * 
1726     * <BR /><BR /><DIV CLASS=JDHint>
1727     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1728     * </DIV>
1729     * 
1730     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1731     * for the specified matches, and an index-pointer as an integer will be returned.
1732     * 
1733     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1734     * from where the search shall start.
1735     * 
1736     * @param n This is the number of matches to skip when searching for character {@code 'c'}
1737     * before returning an answer.
1738     * 
1739     * @param c This is the character that will be 'searched-for' in input-parameter
1740     * {@code String 'srcStr'}.
1741     * 
1742     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1743     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> in {@code 'srcStr'}
1744     * from position {@code 'fromIndex'}</I>
1745     * 
1746     * @throws NException If the value of {@code 'n'} is negative, or greater than
1747     * {@code srcStr.length()}, this exception shall throw.
1748     */
1749    public static int nthLeft(String srcStr, int fromIndex, int n, char c)
1750    {
1751        NException.check(n, srcStr);
1752
1753        LV l = new LV(srcStr, 0, fromIndex);
1754
1755        for (int i=l.end; i >= 0; i--)
1756            if (c == srcStr.charAt(i)) if (--n == 0) return i;
1757
1758        return -1;
1759    }
1760
1761    /**
1762     * Search for the <B STYLE='color: red'>nth</B> occurence of substring {@code 'cmpStr'} in
1763     * {@code 'srcStr'}, but <I>begin the search at index-position {@code 'fromIndex'}
1764     * and work <B STYLE='color: red'>left</B>.</I>  Return the integer index-location into
1765     * {@code 'srcStr'} where the match occured.
1766     * 
1767     * <BR /><BR /><DIV CLASS=JDHint>
1768     * The comparisons performed <B STYLE='color: red'>** are **</B> case-sensitive
1769     * </DIV>
1770     * 
1771     * @param srcStr This may be any {@code java.lang.String}.  It's contents will be searched
1772     * for the specified matches, and an index-pointer as an integer will be returned.
1773     * 
1774     * @param fromIndex This is the right-most index-position in {@code 'srcStr'} (*INCLUSIVE*)
1775     * from where the search shall start.
1776     * 
1777     * @param n This is the number of matches to skip when searching for substring {@code 'cmpStr'}
1778     * before returning an answer.
1779     * 
1780     * @param cmpStr This is the sub-string that will be 'searched-for' in input parameter
1781     * {@code String 'srcStr'}.
1782     * 
1783     * @return The {@code String} index of the <B STYLE='color: red'>nth</B> identified sub-string
1784     * match in {@code 'srcStr'}, <I>counting <B STYLE='color: red'>left</B> in {@code 'srcStr'}
1785     * from position {@code 'fromIndex'}</I>
1786     * 
1787     * @throws NException If the value of {@code 'n'} is negative, or greater than
1788     * {@code srcStr.length()}, this exception shall throw.
1789     */
1790    public static int nthLeft(String srcStr, int fromIndex, int n, String cmpStr)
1791    {
1792        NException.check(n, srcStr);
1793
1794        LV  l           = new LV(srcStr, 0, fromIndex, cmpStr.length());
1795        int cmpStrLen   = cmpStr.length();
1796
1797        for (int i=l.end; i >= 0; i--)
1798            if (srcStr.regionMatches(i, cmpStr, 0, cmpStrLen)) if (--n == 0) return i;
1799
1800        return -1;
1801    }
1802
1803}