public static String optionallyRemoveFollowingSlash ( final String path ) { // Precondition check assertSpecified ( path ) ; // Is there's a last character of slash if ( isLastCharSlash ( path ) ) { // Return everything but last char return path . substring ( 0 , path . length ( ) - 1 ) ; } // Return as-is return path ; }
Removes if present the absolute slash following the specified path and returns the adjusted result .