how to minus the last 5 characters from a string java code example Example: remoce last character froma java string str = str.substring(0, str.length() - 1);