Monday, February 2, 2015

Split.java in programe



Split.java
public class Split
{
    public static void main(String[] args)
       {
        String name = args[0];              
        int N = Integer.parseInt(args[1]);  
        String delimiter = args[2];         

       
        Out[] out = new Out[N];
        for (int i = 0; i < N; i++)
        {
            out[i] = new Out(name + i);
        }

        In in = new In(name + ".csv");
        while (in.hasNextLine())
       {
            String line = in.readLine();
            String[] fields = line.split(delimiter);
            for (int i = 0; i < N; i++)
       {
                out[i].println(fields[i]);
            }
        }
    }
}

No comments:

Post a Comment