java - String formatting, how to give equal width to 'iiii' and 'wwww' -


i want make output of jconsole similar of table. concatenate strings form 'rows'. in order resemble real table (sub)strings form row should have equal physical length.

something this:

aaa aaa aaa bbb bbb bbb ccc ccc ccc 

i use following method set length of string.

private string fillwithspace(string s){             if(s == null){                 s = " null                    ";             }             while(s.length()<constant_length){                 s = s + " ";             }                    return s;         } 

but not me if letters have different width. there clever way give iii , www same physical width?

you should use monospaced font.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -