test unitaire 13 carractère isbn

This commit is contained in:
emile.malcuit
2025-09-26 11:20:29 +02:00
parent a7b45071cc
commit 9593ca5fab
3 changed files with 57 additions and 8 deletions

View File

@@ -12,8 +12,20 @@ public class LivreValide {
// 1. ISBN : exactement 13 chiffres
public static boolean isValidIsbn(String isbn) {
// TODO Emile: implémenter la validation
//Init branch
return false;
boolean valide = true;
if(isbn.length() == 13){
int i = 0;
while (i < 13 && valide) {
if(!Character.isDigit(isbn.charAt(i))){
valide = false;
}else{
i++;
}
}
}else{
valide = false;
}
return valide;
}
// 2. Titre : pas de balises HTML/JS (<script>, <img>, etc.)