We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › loadstring and println
Page Index Toggle Pages: 1
loadstring and println (Read 331 times)
loadstring and println
Dec 17th, 2008, 4:18pm
 
Im too new to processing, your help would be great!

I have added the code for loadstring to open my text file in println

String lines[] = loadStrings("text.txt");
println(lines.length);
for (int i=0; i < lines.length; i++) {
 println(lines[i]);
}

In my text file, there are "A" "S" "C" "H" "T" "B", every char per line.

How can I show "I got C" if C displays on println.

I have tried making codes something like this:

String lines[] = loadStrings("text3.txt");
for (int i=0; i < lines.length; i++) {
 println(lines[i]);
}
if (String a = "C") {
println ("I got C");
}

Thanks
Re: loadstring and println
Reply #1 - Dec 17th, 2008, 5:16pm
 
Code:
String lines[] = loadStrings("text3.txt");
for (int i=0; i < lines.length; i++) {
println(lines[i]);
if(lines[i].equals("C"))
{
println("I got C");
}
}
Re: loadstring and println
Reply #2 - Dec 17th, 2008, 6:21pm
 
thanks!
Page Index Toggle Pages: 1