java - how to format output of resultSet correctly -
I have the code of the following code which should be formatted correctly in Java resultSet . It does not do that though it seems to me. I wonder why I am getting this weird formatted output.
The inserted questions look like this:
COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY) INSERT values (1, 'Paul ', 32,' California ', 23000.00); INSERT (2, 'stevie', 24, 'new jersey', 22,000.00) values in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY); INANSETT (3, 'George', 29, 'Colorado', 21000.00) values in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY); INANSETT (4, 'Andrew', 26, 'Washington', 25000.00) in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY); INANSETT (5, 'ANDY', 26, 'Texas 2', 28000.00) in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY); Any help would be greatly appreciated.
format in Java, the minimum number of characters that are written in the width output Specifies. If you want to shorten a longer text field (such as an address), you should try to use it as well, in addition to the non-text areas on the toString () method of the object Depending on formatting, you probably want to trim them first:
System.out Printf ("% 12.12s", o2.toString (.) Trim ());
Comments
Post a Comment