question: public static String replaceLast ( String s , String sub , String with ) { int i = s . lastIndexOf ( sub ) ; if ( i == - 1 ) { return s ; } return s . substring ( 0 , i ) + with + s . substring ( i + sub . length ( ) ) ; }
target:  Replaces the very last occurrence of a substring with supplied string.