Here you can find the source of lastIndexOf(String str, String searchChar)
public static int lastIndexOf(String str, String searchChar)
//package com.java2s; //License from project: Open Source License public class Main { public static int lastIndexOf(String str, String searchChar) { if (isEmpty(str)) { return -1; }//from w w w . jav a 2 s .c o m return str.lastIndexOf(searchChar); } public static boolean isEmpty(String command) { return command == null || command.trim().isEmpty(); } }