Here you can find the source of deleteLastIf(String str, String eq_str)
public static final String deleteLastIf(String str, String eq_str)
//package com.java2s; //License from project: Apache License public class Main { public static final String deleteLastIf(String str, String eq_str) { if (str == null) return null; if (str.substring(str.length() - eq_str.length(), str.length()) .equals(eq_str)) {//from w w w.j a va2 s .c o m return str.substring(0, str.length() - eq_str.length()); } else { return str; } } }