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
|
String regex = "[a-zA-Z]";
while ((ligne = br.readLine()) != null) {
// Suite de condition permettant d'extraire des lignes grace a leurs debut
if(ligne.startsWith("Photographer : ")) {
System.out.println(ligne);
photographer = ligne.substring(15);
}else if (ligne.startsWith("Photo URL")) {
System.out.println("Photo URL : " + ligne.substring(52,61));
photo_url = ligne.substring(52,61);
}else if(ligne.startsWith("Taken Date")) {
System.out.println(ligne);
Taken_Date = ligne.substring(12);
}else if(ligne.matches(regex)) {
System.out.println("Titre : " + ligne);
titre = ligne.substring(0);
}else if (ligne.startsWith("Ap")) {
System.out.println("Description : " + ligne);
description = ligne.substring(0);
}else if(ligne.startsWith("N",1)) {
System.out.println("Tags : " + ligne.substring(0));
tags = ligne.substring(0);
}
}
br.close();
}catch (Exception e) {
System.out.println(e.toString());
} |
Partager