I need to create a summary table at the end of a log with some values that are obtained inside a class. The table needs to be printed in fixed-width format. I have the cod
For readability, I prefer this:
if (inputString.length() > maxLength) { inputString = inputString.substring(0, maxLength); }
over the accepted answer.
int maxLength = (inputString.length() < MAX_CHAR)?inputString.length():MAX_CHAR; inputString = inputString.substring(0, maxLength);