Sunday 15 July 2012

format - java, print in bold -


How do I print output in bold in printf? "[1m bold test" does nothing.

  string format = "% -20s% -15s% -20s% -15s% -10s"; System.out.printf (format, "name", "group_name", "javascript_level", "cpnnr", "gender", "[1m trial bold");  

You do not print bold with java System.out Can do It only streams on the standard output stream, so in principle, it is only unchanged text

However, some software describes specific character sequences (the so-called ANSI escape sequence) to allow format formatting. is.

Note that the ANSI escape sequence starts with an escape character, so you have to add it to your string as well. ( "\ u001b [1m I am bold" ].

Most UNIX terminals interpret the ANSI escape sequence by default. In Old DOS time, you work To do escape sequences, it is necessary to use ANSI.SYS .

Codes do not work in Windows and Eclipse terminals.

< / Html>

No comments:

Post a Comment