diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/src/main/java/com/mycompany/bibliotheque/Contrôle/LivreValide.java b/src/main/java/com/mycompany/bibliotheque/Contrôle/LivreValide.java index 899d7b6..bdec9cf 100644 --- a/src/main/java/com/mycompany/bibliotheque/Contrôle/LivreValide.java +++ b/src/main/java/com/mycompany/bibliotheque/Contrôle/LivreValide.java @@ -11,8 +11,21 @@ package com.mycompany.bibliotheque.Contrôle; public class LivreValide { // 1. ISBN : exactement 13 chiffres public static boolean isValidIsbn(String isbn) { - // TODO: implémenter la validation - return false; + // TODO Emile: implémenter la validation + 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 (