Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Java :: How to efficiently find the longest common subsequence of two strings, in Java? 
Java :: display in java 
Java :: How to draw Bezier Curve in Android 
Java :: java substring after last char 
Java :: transpose of a matrix java 
Java :: java get attributes from class 
Java :: throw error java 
Java :: mapping over a list of promises in javaascript 
Java :: check stack empty java 
Java :: java read a line of input 
Java :: java mail use tls 1.2 
Java :: java throw an exception 
Java :: change size of array java 
Java :: java vector push_back 
Java :: java program to find the power of a number 
Java :: 2d array java 
Java :: java print default options 
Java :: how to break switch case in java 
Java :: math.min java 
Java :: string methods in java 
Java :: is java compiled or interpreted 
Java :: rainbow six 
Java :: java sort arraylist of arraylist 
Java :: float java 
Java :: hashmap get value by key java 
Java :: from file to array java 
Java :: java array sorting java8 
Java :: hide app after install android studio 
Java :: Java Create a BufferedWriter 
Java :: java string join 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =