question: public static String removeFromEndOfString ( String source , String stringToRemove ) { if ( stringToRemove == null ) { return source ; } String result = source ; if ( source != null && source . endsWith ( stringToRemove ) ) { result = source . substring ( 0 , source . length ( ) - 1 ) ; } return result ; }
target:  Remove the stringToRemove from source when existing