Originally posted by kenvin100
how to align things
Collapse
X
-
What is the 27 doing there. You are supposed to put spaces as inOriginally posted by kenvin100no problem...i used string out instead..
String out = "";
int space = 0;
int spaces = 50 - item.length();
out = ""; //declare the variable space
for(int i = 0 ;i < 27; i++) {
out += " "; //
}
Code:for(int i = 0 ;i < spaces; i++)
Comment
-
item1------------------------------------------20Originally posted by kenvin100wat does 50-item.length(); mean
myItem2--------------------------------------30
mylongerItem-------------------------------40
The area marked --------------------- is what we are trying to construct and store it as space(variable) ;
First we have to know how many dashs (spaces).
Suppose that where we have the 20, 30, 40 is exactly 50 spaces from the left of the screen. Then spaces = 50 - item1.length();Comment
Comment