public static String removeTrailingDelimiter ( String str , String delimiter ) { if ( ! str . endsWith ( delimiter ) ) { return str ; } else { return str . substring ( 0 , str . length ( ) - delimiter . length ( ) ) ; } }
Removes the trailing delimiter from a string .