String a = "1,235,345,234,123,234,345.\n";
String[] temp = split(a,',');
String CH = temp[0].replace("\n","");
if (CH.equals("0")) println("CH is 0");
else if (CH.equals("1")) println("CH is 1");
else if (CH.equals("2")) println("CH is 2");
println("completed");
and understand that the way you posted your code
makes it unusable.
also the 3d line code is wrong, as it looks for temp[0] ( “1” )
but the “\n” is in temp[6]
please use a print after each operation to understand what it does.
I’m so sorry but problem occured again
My arduino sends
0,value,value,value,value,value,value.
1,value,value,value,value,value,value.
2,value,value,value,value,value,value.
0,value,value,value,value,value,value.
.
.
.
by serial
I thought “\n” is in temp[0]
So i placed replace("\n","") to temp[0]
But it only prints
“completed”
“completed”
“completed”
.
.
.