public class Fichier_N
{
/*
* Ce programme modifie le nom d'un fichier pour l'adapter à Windows
*/
public static String adapter_NomFichier(String nom_fichier)
{
// Remplacer les caractères spéciaux par un tiret
return nom_fichier.replaceAll("[:\/*?|<>]", "-");
}
public static void main(String args[]) throws Exception
{
System.out.println("Le nom de votre fichier à été modifié par==> " + adapter_NomFichier("test?de <*mp.txt"));
}
}