2023-06-22 13:27:37 +02:00
|
|
|
package baseUFRHG;
|
|
|
|
|
|
|
|
import java.text.Normalizer;
|
|
|
|
|
|
|
|
public class supprimeCaracatresSpeciaux {
|
|
|
|
|
2023-07-06 21:29:16 +02:00
|
|
|
public static String TousLesCaracatresSpeciaux(String str) {
|
2023-06-22 13:27:37 +02:00
|
|
|
// Supprimer les accents
|
|
|
|
String normalizedStr = Normalizer.normalize(str, Normalizer.Form.NFD);
|
|
|
|
String accentRemovedStr = normalizedStr.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
|
|
|
|
|
|
|
|
// Supprimer les caractères spéciaux
|
|
|
|
String specialCharRemovedStr = accentRemovedStr.replaceAll("[^a-zA-Z0-9@\\_\\-\\. ]", "");
|
|
|
|
|
|
|
|
//Replace tous les espaces par des underscore
|
|
|
|
String replaceSpace = specialCharRemovedStr.replaceAll(" ","_");
|
|
|
|
|
|
|
|
return replaceSpace;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|