久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

讀取制表符分隔的文本文件 java

reading tab delimited textfile java(讀取制表符分隔的文本文件 java)
本文介紹了讀取制表符分隔的文本文件 java的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

10
aaa aaa aaa
bbb bbb bbb
ccc ccc ccc
ddd ddd ddd

我有一個文本文件,我試圖用制表符分隔符讀取.每當我讀取文件時,我在 10 之后得到一個 arrayindexoutofbound 錯誤.我在網上搜索,發現我必須在 后面添加一個 -1,但我仍然得到同樣的錯誤.

I have a textfile that Im trying to read with tab delimiters. whenever i read the file, i get an arrayindexoutofbound error after the 10. i search online and found that i have to add a -1 behind the but i still get the same error.

 try{
        Scanner scan = new Scanner(new File("1.txt"));
        String line="";
        int readline = Integer.parseInt(scan.nextLine());//

        while (scan.hasNextLine())
        {
            line = scan.nextLine();

            if(line.equals("ccc"))
            {  
                break;
            }
        String[] split=line.split("	");

            array.add(split);
        } 

推薦答案

如果你使用Scanner這里不需要split,你可以使用next()這里如下

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());
    }

這篇關于讀取制表符分隔的文本文件 java的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 国产传媒在线观看 | 中文字幕高清 | 成人扒开伸进免费观看 | 草草视频在线观看 | 久操不卡 | 日本高清视频www | 亚洲精品久久久久久久久 | 成人毛片在线 | 日韩视频二区 | 亚洲综合影院 | 网站av | 亚洲影院一区 | 久久99深爱久久99精品 | 黄色片网站免费 | 国产在线成人 | 欧美性久久 | 黄色午夜 | 日韩中文在线视频 | 国产毛片av | 精品国产一区二 | 日韩精品久久久久 | 日韩亚洲天堂 | 亚洲成人精品在线观看 | 狠狠五月| 精品视频免费 | 美女黄色免费网站 | 手机av在线播放 | 久久精品一区二区三区四区五区 | 一区在线观看视频 | 99视频在线精品免费观看2 | av网址在线 | 在线日韩 | 国产乱码一区二区三区 | 欧美又大又硬又粗bbbbb | 亚洲日本视频 | 一个色综合网 | 999av| 亚洲午夜视频在线观看 | 麻豆国产一区二区三区四区 | 日韩一区精品 | 精品精品 |