Bonsoir,
 
je cherche à réaliser une méthode qui doit récupérer des informations contenues dans un fichier .txt. je veux trouver comment récuperer plusieurs informations sur la même ligne.
 
sachant que chaque ligne contiendra :  
[string] puis un [string] puis un [string] puis un [string] puis un [double] et a la finun [int], et je dois récupérer ces 3 infos pour chaque ligne
 
exemple de fichier .txt
 
L012	MADAME THERESE	Biographie	A082  15.00	219
L014	LE DERNIER DES MOHICANS	Essai	A037  15.80	222
L016	PINOCCHIO	Roman	A032  14.00	132
L018	LE PETIT CHOSE	Roman	A043  21.00	115
L020	LETTRES DE MON MOULIN	Nouvelles	A043  14.60	188
L022	DON QUICHOTTE DE LA MANCHE	Roman	A021  11.50	347
L024	EUGENIE GRANDET	Roman	A054  23.45	255
L026	LE LYS DANS LA VALLEE	Roman	A054  23.00	411
L030	LES MISERABLES	Roman	A085  9.50	418
L032	LES TRAVAILLEURS DE LA MER	Roman	A085  19.00	362
 
j'ai essayé avec ca :
 
 public void lireBddLivre(String nomFichier) throws IOException {
 	// TODO Auto-generated method stub
       Scanner s = new Scanner(new File(nomFichier));
         s.useDelimiter("\t" );
         
         String titre;
         String code;
         String codeAuteur;
         String categorie;
         int nbPages;
         double prix;
         
         while(s.hasNext())
         {
              code=s.next();
              titre=s.next();
              categorie=s.next();
              codeAuteur=s.next();
              prix=s.nextDouble();
              nbPages=s.nextInt();  //sachant que je dois passer a la ligne suivante !
           
              Livre l = new Livre(titre,code,codeAuteur,categorie,nbPages,prix);
              addLivre(l);
         }
         s.close();
 }
 
quelqu'un peut-il m'aider  SVP ?
 
Édité par Elmoricq : modification du titre ; les titres tout en majuscules sont prohibés, cf. règles de la section.
 
Message édité par Elmoricq le 23-09-2010 à 14:02:18