Le programme ne rentre jamais dans mon "if" sur une chaîne de caractères
Bonjour,
J'essaye de recuperer seulement une partie de ma chaine de caractere pour la stocker dans un tableau.
J'ai le code suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| String[] str_frame = str_data.split("=>");
int frame_length=str_frame.length;
for(int i=1;i<frame_length;i++){
int array_frame_length = str_frame[i].length();
//System.out.println(str_frame[i]);
System.out.println(array_frame_length);
System.out.println(str_frame[i].substring(array_frame_length-3,array_frame_length));
if(str_frame[i].substring(array_frame_length-3,array_frame_length)=="<= ")
{
System.out.println("OK");
}
} |
J'entre des donnees de ce type:
Citation:
=> 160718,105950,Lat:50.102778,Long:14.393270,NbSat:9,Alt:267,T1:120.520157 <=
=> 160718,110021,Lat:50.102806,Long:14.393231,NbSat:9,Alt:261,T1:120.358986 <=
=> 160718,110052,Lat:50.102817,Long:14.393177,NbSat:7,Alt:258,T1:121.728928 <=
=> 160718,110123,Lat:50.102765,Long:14.393217,NbSat:9,Alt:264,T1:120.358986 <=
J'obtiens le resultat suivant:
Code:
1 2 3 4 5 6 7 8
| 77
<=
77
<=
77
<=
76
<= |
J'aimerais savoir pourquoi je n'obtiens pas:
Code:
1 2 3 4 5 6 7 8 9 10 11
| 77
<=
OK
77
<=
OK
77
<=
OK
76
<= |
Merci pour vos reponses