Java String Last Index Of lastIndexOf(String text, String key, int num)

Here you can find the source of lastIndexOf(String text, String key, int num)

Description

last Index Of

License

Apache License

Declaration

public static int lastIndexOf(String text, String key, int num) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static int lastIndexOf(String text, String key, int num) {
        int index = -1;
        int fromIndex = text.length() - 1;
        for (int i = 0; i < num; i++) {
            index = text.lastIndexOf(key, fromIndex);
            fromIndex = index - 1;//from w w w  .j  a  v  a 2  s .  c om
        }
        return index;
    }
}

Related

  1. lastIndexOf(String str, String substr)
  2. lastIndexOf(String string, char value, int startIndex, int count)
  3. lastIndexOf(String string, char... chars)
  4. lastIndexOf(String string, String substring)
  5. lastIndexOf(String text, int startPos, String... searchStrings)
  6. lastIndexOf(String what, String within)
  7. lastIndexOf(StringBuffer buf, String str)
  8. lastIndexOfAny(final String delimiters, final String str)
  9. lastIndexOfAny(String str, String search, int offset)