0
我有文件存储为“Integer-> \ t(选项卡) - >字符串 - >几个空间 - >”的数据。拆分文件只有整数和字符串字符串
我做错了吗?
我在做什么。
Trie t = new Trie();
BufferedReader bReader = new BufferedReader(new FileReader(
"H:\\100kfound.txt"));
String line;
String[] s = null;
while ((line = bReader.readLine()) != null) {
s = line.split("\t");
}
int i;
for (i = 0; i < s.length; i++) {
System.out.println(s[i]);
if (!(s[i].matches("\\d+"))) {
t.addWord(s[i]);
System.out.println(s[i]);
}
}
我可以通过调试它是正确下去,直到while循环,但在for循环,它只是存储两个字符串并打印相同的看到。
你知道你用这段代码扔掉了所有的行,但最后一行吗? –