Simple file manipulation
in
Programming Questions
•
2 years ago
hi i have red in a .ged file which consists of a number at the start of each line (0,1,2 or 3) i want to check to see if it is a 0 so i can then print a part of that line but my head is melted from alot of work and i cant even think im pretty sure its really simple but i just cant see it here is the code.
- String[] lines;
String allText;
void setup()
{
size(700, 400);
smooth();
background(0);
lines = loadStrings("kennyTree.ged");
allText = join(lines, " ");
println("There are " + lines.length + " lines");
for (int i=0; i < lines.length; i++)
{
println(lines[i]);
}
findName(lines);
}
void draw()
{
findName(lines);
}
public void findName(String[] lines)
{
for(int i = 0; i < lines.length; i++)
{
if(lines[i].equals("0"))
{
println("FOUND AN 0 HERE");
}
}
}
1