Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java printf tab

String prefix1 = "short text:";
String prefix2 = "looooooooooooooong text:";
String msg = "indented";
/*
* The second string begins after 40 characters. The dash means that the
* first string is left-justified.
*/
String format = "%-40s%s%n";
System.out.printf(format, prefix1, msg);
System.out.printf(format, prefix2, msg);

result:
short text:                             indented
looooooooooooooong text:                indented
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #printf #tab
ADD COMMENT
Topic
Name
1+5 =