Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. private static String[][] lerFicheiro(String nome) throws FileNotFoundException {
  2.  
  3.         int linhas = contarLinhas(nome);
  4.  
  5.         Scanner readF = new Scanner(new File(nome));
  6.         String[][] mat = new String[linhas][COLUNAS];
  7.  
  8.         while (readF.hasNext()) {
  9.  
  10.             for (int l = 0; l < mat.length; l++) {
  11.                 String line = readF.next();
  12.                 if (line.length() > 0) {
  13.                     String[] lineS = line.trim().split(";");
  14.                     if(lineS.length==COLUNAS){    
  15.                     for (int c = 0; c < mat[0].length; c++) {
  16.                         mat[l][c] = lineS[c];
  17.                     }
  18.                     }
  19.  
  20.                 }
  21.             }
  22.  
  23.         }
  24.         readF.close();
  25.         return mat;
  26.  
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement