我有一个文件,就是这个格式:
City|the Location|the residence of the customer| the age of the customer| the first name of the customer|
我需要读一下第一行, 确定符号"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
这就是我的代码:
`` `FileInputStream fs = new FileInputStream("C:/test.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(fs));
StringBuilder sb = new StringBuilder();
for(int i = 0; i < 0; i++){
br.readLine();
}
String line = br.readLine();
System.out.println(line);
String[] words = line.split("|");
for (int i = 0; i < words.length; i++) {
int counter = 0;
if (words[i].length() >= 1) {
for (int k = 0; k < words[i].length(); k++) {
if (Character.isLetter(words[i].charAt(k)))
counter++;
}
sb = new StringBuffer();
sb.append(counter).append(" ");
}
}
System.out.println(sb);
}
`` `
我对雅法非常新