从文件更改中读取内容并修改打印 [英] Read contents from file change and print modified
问题描述
条件字符串排序的方式是什么
比如说
java.txt有内容
计算机科学{w} [java。] [péj。]人工智能[coll。]
Java {c} [和](+)Android
带有java缓冲读取内容的
what is the way for conditional string sort
say for instance
java.txt has the contents
Computer Science {w} [java.] [péj.] Artificial Intelligence [coll.]
Java {c} [and] (+) Android
with java buffered read read contents
String fileName = "src/FileSystem/java.txt";
try (BufferedReader br = new BufferedReader(new FileReader(fileName)))
{
print changed contents
}
应打印
计算机科学人工智能
Java Android
文件中有很多其他记录,但必须更改,以便按要求结果
我有什么试过:
带有几种组合的java文件阅读器
should print
Computer Science Artificial Intelligence
Java Android
there are lot of other records from file but must change so that result is as required
What I have tried:
java file reader with several combinations
推荐答案
它叫做解析。您读取每一行并提取未被括号括起来的字段并打印其余部分。 Java String类将有很多辅助方法来帮助您。
It's called parsing. You read each line and extract the fields that are not surrounded by brackets and print the rest. The Java String class will have plenty of helper methods to assist you.
这篇关于从文件更改中读取内容并修改打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!