Condition

I have a problem when I want to use de condition in a script. My code is this.

int c1=7;
int c2=8;
int i=2;
String[] tipo = new String[10];

String e = datos.substring(c1, c2);
String eq = datos.substring(6, 7);
while(e!=']'){
    e = datos.substring(c1, c2);
    if(e!=']'){
    eq = eq + e;
    c1++;
    c2++;
    }
    
}
 fecha = eq;

In de condition of IF I need to use IF(e!=',') but if a use this condition doesnt work can you help me beacuse I need use this condition

hello,

maybe you have to put  [ c1++;c2++; ] out of your [ IF ] ?

because in case [ e=="," ] your [ WHILE ] will never end.

regards,

Julien Mege.

Hello
In your case, is the method indexOf(String str) is more appropriate?
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(java.lang.String)

but if it is not, check if your condition works well with a if(!e.equals("]")) because your code seems that your compare a string to a character.

I hope this was helpful to you

Regards

Nicolas

Hi jhosimar,

Just to be sure that I got your code but... where the object 'datos' came from? Did you declare the variable 'fecha' first at some point of your code?