Bug 932 : split() array element results in conditional statement not working.
Last modified: 2008-09-28 09:51




Status:
RESOLVED
Resolution:
INVALID -
Priority:
P2
Severity:
normal

 

Reporter:
lemurgoddess
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-09-27 18:14
build 0148
Windows XP
AMD Athlon 64 Processor 3700+

Not sure if this is some kind of issue, or I'm just missing something
important. I could really use some help!

When I use split to parse a string, it successfully cuts up the string into
elements of an array. HOWEVER, when I then try to test an element in the
resulting array in a conditional, it doesn't work.

For example, to use slightly modified code from the Reference section:

------------------------------------
String men = "Chernenko,Andropov,Brezhnev";
String[] list = split(men, ',');

println(list[0]);

if (list[0] == "Chernenko"){
println("it worked!");
}
-------------------------------------

This code only outputs "Chernenko". It does not print "it worked!", the
conditional is not met. Even though printing list[0] displays a value of
"Chernenko", it does not recognize it as that in the conditional statement.


Did I explain that clearly? Can any tell me why this isn't working... or
what I am doing wrong?

Thanks!
Additional Comment #1 From fry 2008-09-28 09:51
no, strings don't work that way, please read this:
http://processing.org/reference/troubleshooting/index.html#strings