readLine()函数读取后输出有有关问题
readLine()函数读取后输出有问题
程序如下
public TEST() throws FileNotFoundException, IOException {
initComponents();
File file = new File("src/airline/picture/" + "01" + "/" + "01" + "/" + "01.txt");
BufferedReader rd = new BufferedReader(new FileReader(file));
String str =null;
str = (String)rd.readLine().trim();
str.substring(2,4);
System.out.println(str);
}
01.txt中写的是ABCD
输出后为什么是这个样子?前面有个点呢?

------解决思路----------------------
这个和txt的文件编码有关,把编码改为ANSI应该就好了
程序如下
public TEST() throws FileNotFoundException, IOException {
initComponents();
File file = new File("src/airline/picture/" + "01" + "/" + "01" + "/" + "01.txt");
BufferedReader rd = new BufferedReader(new FileReader(file));
String str =null;
str = (String)rd.readLine().trim();
str.substring(2,4);
System.out.println(str);
}
01.txt中写的是ABCD
输出后为什么是这个样子?前面有个点呢?
------解决思路----------------------
这个和txt的文件编码有关,把编码改为ANSI应该就好了