package ccm.kx; import java.nio.file.*; public class TextTools { public static String revert(String text, char c1, char c2, char tmp) { text = text.replace(c1, tmp); // c1 ← tmp text = text.replace(c2, c1); // c2 ← c1 text = text.replace(tmp, c2); // tmp ← c2 return text; } public static void main(String[] args) throws Exception { Path path = Paths.get("C:/test.txt"); String text = new String(Files.readAllBytes(path)); text = revert(text, '0', '1', '§'); Files.write(path, text.getBytes()); } }
11 juin 2016 à 11:50
11 juin 2016 à 12:43
1) Ouvrir ton fichier .txt (avec le bloc notes ça suffit)
2) Rechercher/Remplacer (Ctrl+H) tout les 0 en 2 (par exemple)
3) Remplacer tout les 1 en 0
4) Remplacer tout les 2 en 1
11 juin 2016 à 13:26
11 juin 2016 à 17:16