We are about to switch to a new forum software. Until then we have removed the registration on this forum.
how do i space out strings in processing?
example: Employee id Employee Name hours worked
1 bob 40
Here's my source code
// load the employee file
String[] id = loadStrings("id.txt");
for(int i = 0; i < id.length; i++)
println(id[i]);
// load the employee file
String [] employeename = loadStrings("employeename.txt");
for(int i = 0; i < employeename.length; i++)
println(employeename[i]);
String [] hoursworked = loadStrings("hoursworked.txt");
for(int i = 0; i < hoursworked.length; i++)
println(hoursworked[i]);
Answers
how do make the text horizontal?
println(...)
will print something and move the text insertion point to the start of the next line. Try usingprint(...)
, this will still print something but will leave the text insertion point at the end of the print sodisplays
i want it to be horizontal like this
So some of your statements will use
print
and the last item on the line will useprintln
try it!ok, thanks
@Maaother -- are you trying to display visually aligned tabular data, like this?
...and are you trying to make it visually aligned just in the console, on the display canvas and in the console?
Yeah, I think
+“\t“+ could be useful in the console but not in the canvas; it’s a tab.
In the canvas you need some kind of array so each column knows its position