java 去除文本文件中换行和空格
// 读取文本中所有内容
String path="D:\\Desktop\接口\\postman\\jsonArray.txt";
List<String> lines = Files.readAllLines(Paths.get(path), StandardCharsets.UTF_8);
String content= String.join(System.lineSeparator(),lines);
System.out.println("content = "+content);
// 去除空格换行
content = content.replaceAll("\r|\n", "").replace(" ", "");
System.out.println("content = "+content);