Here you can find the source of lastIndexOf(CharSequence charSeq, char ch)
public static int lastIndexOf(CharSequence charSeq, char ch)
//package com.java2s; /*!//from w w w .j av a2 s . co m * mifmi-commons4j * https://github.com/mifmi/mifmi-commons4j * * Copyright (c) 2015 mifmi.org and other contributors * Released under the MIT license * https://opensource.org/licenses/MIT */ public class Main { public static int lastIndexOf(CharSequence charSeq, char ch) { if (charSeq == null) { return -1; } return lastIndexOf(charSeq, ch, charSeq.length() - 1); } public static int lastIndexOf(CharSequence charSeq, char ch, int fromIndex) { if (charSeq == null) { return -1; } for (int i = fromIndex; 0 <= i; i--) { char c = charSeq.charAt(i); if (c == ch) { return i; } } return -1; } public static int lastIndexOf(CharSequence charSeq, char[] ch) { if (charSeq == null) { return -1; } return lastIndexOf(charSeq, ch, charSeq.length() - 1); } public static int lastIndexOf(CharSequence charSeq, char ch[], int fromIndex) { if (charSeq == null) { return -1; } for (int i = fromIndex; 0 <= i; i--) { char c = charSeq.charAt(i); for (int j = 0; j < ch.length; j++) { if (c == ch[j]) { return i; } } } return -1; } }