Here you can find the source of substringAfterLast(String text, char after)
public static String substringAfterLast(String text, char after)
//package com.java2s; // Metawidget (licensed under LGPL) public class Main { /**// w w w .ja va2 s . c o m * Returns the portion of the overall string that comes after the last occurance of the given * string. If the given string is not found in the overall string, returns the entire string. */ public static String substringAfterLast(String text, char after) { int indexOf = text.lastIndexOf(after); if (indexOf == -1) { return text; } return text.substring(indexOf + 1); } /** * Returns the portion of the overall string that comes after the last occurance of the given * string. If the given string is not found in the overall string, returns the entire string. */ public static String substringAfterLast(String text, String after) { int indexOf = text.lastIndexOf(after); if (indexOf == -1) { return text; } return text.substring(indexOf + after.length()); } }