public static void ensureEndsWithSlash ( StringBuilder str ) { if ( str . length ( ) == 0 || str . charAt ( str . length ( ) - 1 ) != ' ' ) { str . append ( ' ' ) ; } }
Given a string builder this ensures its last character is a forward - slash .