Here you can find the source of subString4lastIndex(String string, String regex)
public static String subString4lastIndex(String string, String regex)
//package com.java2s; //License from project: Open Source License public class Main { public static String subString4lastIndex(String string, String regex) { if (isNullOrEmpty(string) || isNullOrEmpty(regex)) { return string; }/*from ww w .j a va 2 s .c o m*/ if (string.indexOf(regex) == -1) { return string; } return string.substring(string.lastIndexOf(regex) + regex.length()); } public static boolean isNullOrEmpty(String s) { return s == null || s.length() == 0; } public static boolean isNullOrEmpty(String... ss) { for (String s : ss) { if (s == null || s.length() == 0) { return true; } } return false; } }