tableaux de String dans un vector
salut a vous, :mrgreen:
encore une question qui peut etre ""bête""
j'ai parsé un fichier et au fur et a mesure j'ai sauvegardé le resultat dans un tableau puis ce taleau dans un vector
est ce que c logic ??
si oui pouquoi lorsque j'ai utilisé le caste et j'ai recupéré mes tableaux
j'ai trouvé le même élément ????
j'espere que je me suis bien expliqué
merci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
void lecture_fichier() {
BufferedReader filein = null;
try {
filein = new BufferedReader(new FileReader("c:\\monfichier.csv"));
}
catch (FileNotFoundException ex1) {
}
String currentLine;
String buff[] = new String[6];
String test0[] = new String[6];
String test[] = new String[6];
Vector vect = new Vector();
try {
while ( (currentLine = filein.readLine()) != null) {
StringTokenizer st = new StringTokenizer(currentLine, ";");
while (st.hasMoreElements()) {
String ay = st.nextElement().toString();
buff[0] = buff[1];
buff[1] = buff[2];
buff[2] = buff[3];
buff[3] = buff[4];
buff[4] = ay;
if (ay.equalsIgnoreCase("Accumulated path loss difference")) {
String ay2 = st.nextElement().toString();
if (buff[2].equalsIgnoreCase("BBSIG-TPU0")) {
buff[5] = ay2;
test0[0] = buff[5];
test0[1] = buff[4];
test0[2] = buff[3];
test0[3] = buff[2];
test0[4] = buff[1];
test0[5] = buff[0];
vect.addElement(test0);
//System.out.println(test0[0] + " " + test0[1] + " " + test0[2] + " " + test0[3] + " " + test0[4] + " " + test0[5]);
}
}
}
}
for (int i = 0; i < vect.size(); i++) {
System.out.println(i);
test = (String[]) vect.elementAt(i);
System.out.println(test[0] + " " + test[1] + " " + test[2] + " "
+ test[3] + " " + test[4] + " " + test[5]);
}
}
catch (IOException ex) {
}
}
} |