I have DB table tab with column (id, number). The column number means number of star(*), which is display before every row(DB record). I'd like to display result of DB query(select * from tab) in this way: (I used JDBC connection.)
Quoting from a private message from manu chao: I'd like to java solution, not DB solution.
Here's how you can pad the left side of a String with a given number of asterisks in Java:
1. You can create a StringBuffer object that is initially empty. 2. Calculate the number of astericks to append. number - string.length() 3. Append the asterisks to the StringBuffer object 4. Append the original String object to the StringBuffer object 5. Convert the StringBuffer to a String with: sb.toString()
I'll leave it up to you to convert this to actual Java code.