-2
我有一个Java程序在搜索大多数字符串时没有问题,但由于某种原因,我无法找到下面的ina文件,我知道它出现在文件中。我显然试图找到一个具有999的值的特定元素,但我无法这样做。这也适用于其他字符串,但不是下面的字符串。无法在Java文件中查找字符串
for(int i=0;i< inputFile.length;i++)
try {
br = new BufferedReader(new FileReader(inputFile[i]));
try {
while((line = br.readLine()) != null)
{
countLine++;
//System.out.println(line);
String[] words = line.split(" ");
for (String word : words) {
if (word.equals(inputSearch)) {
count++;
countBuffer++;
}
}
if(countBuffer > 0)
{
countBuffer = 0;
lineNumber += countLine + ",";
}
}
br.close();
发表你的代码已经有 – 2014-09-03 12:42:06
你怎么搜索?你在使用正则表达式吗? – duffymo 2014-09-03 12:42:27
你确定该文件包含这个字符串吗? – Miki 2014-09-03 12:43:01