Bugfix lowercase uppercase

main
Cemal Odabasioglu 2023-12-18 09:38:16 +01:00
parent 9deec816e0
commit cce696afe9
1 changed files with 3 additions and 0 deletions

View File

@ -164,6 +164,9 @@ fun formPage(onCancelClick: () -> Unit) {
val wordsList = loadDatasFromFile().toMutableList() val wordsList = loadDatasFromFile().toMutableList()
// Transform name to lowercase to avoid duplicates
name.value = name.value.lowercase()
// Verify if the word already exists in the glossary // Verify if the word already exists in the glossary
if (wordsList.any { it.name.equals(name.value, ignoreCase = true) }) { if (wordsList.any { it.name.equals(name.value, ignoreCase = true) }) {
println("Le mot '${name.value}' existe déjà dans le glossaire. Ajout annulé.") println("Le mot '${name.value}' existe déjà dans le glossaire. Ajout annulé.")