reading tab delimited textfile java

前端 未结 2 584
别那么骄傲
别那么骄傲 2020-12-21 14:26
10
aaa aaa aaa
bbb bbb bbb
ccc ccc ccc
ffffd ffffd ffffd

I have a textfile that Im trying to read with tab delimiters. whenever i read the file, i get an

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 15:04

    If you are use Scanner here no need to split, you can use next() here as follows

        Scanner sc=new Scanner(new FileReader("D:\\test.txt"));
        while (sc.hasNextLine()){
            System.out.println(sc.next());
        }
    

提交回复
热议问题