1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| public static String lireLocalisation(String chaine) {
String localisation=lireValeurAttribut(chaine, "rdf:resource");
if ( localisation!=null && localisation.startsWith("#_") ) {
localisation=localisation.substring(2);
}
return localisation;
}
public static String lireValeurAttribut(String chaine, String nomAttribut) {
int index=chaine.indexOf(nomAttribut);
if ( index>=0 ) {
int indexStart=chaine.indexOf('"',index);
if ( indexStart>=0 ) {
indexStart++;
int indexEnd=chaine.indexOf('"',indexStart);
if ( indexEnd>=0 ) {
return chaine.substring(indexStart,indexEnd);
}
}
}
return null;
} |