Here you can find the source of lastIndexof(char chr, int pos, CharSequence str)
Parameter | Description |
---|---|
chr | a parameter |
str | a parameter |
public static int lastIndexof(char chr, int pos, CharSequence str)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w . j a v a 2s. co m*/ * Charsequence util - lastIndexOf * * @param chr * @param str * @return position of last found char */ public static int lastIndexof(char chr, int pos, CharSequence str) { int rollPos; for (rollPos = pos - 1; rollPos > -1; rollPos--) { if (str.charAt(rollPos) == chr) break; } return rollPos; } /** * * @param chr * @param pos * @param source * @return */ private static int lastIndexof(char chr, int pos, byte[] source) { int rollIndex; // Validation if (source.length == 0) return -1; for (rollIndex = pos; rollIndex > -1; rollIndex--) { if (chr == source[rollIndex]) return rollIndex; } return -1; } }