1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.SQLException;
import java.util.StringTokenizer;
public class csvimport {
public static void main (String[][]args) throws IOException {
public String [][] tab2(){
String [][] data = new String [873][13];
File file = new File("C:/Users/DELL/Desktop/iheb2.csv");
int row = 0;
int col = 0;
BufferedReader bufRdr = new BufferedReader(new FileReader(file));
String line = null;
//read each line of text file
while((line = bufRdr.readLine()) != null && row < data.length)
{
StringTokenizer st = new StringTokenizer(line,";");
while (st.hasMoreTokens())
{
//get next token and store it in the array
data [row][col] =(st.nextToken());
col++;
}
col = 0;
row++;
}
for (int i=0;i<=870;i++){
for (int j=0;j<=4;j++){
System.out.println(data[i][j]);
}
}
return data;
return null;
}
private static String parsestring(String nextToken) {
// TODO Auto-generated method stub
return null;
}
} |
Partager