Pagini recente » Cod sursa (job #915081) | Cod sursa (job #2529270) | Cod sursa (job #1361786) | Cod sursa (job #1349669) | Cod sursa (job #1359864)
import java.io.*;
import java.util.*;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Roxana Capitanu
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
String allText = null, line;
// String head;
String list[];
BufferedReader br;
br = new BufferedReader(new FileReader("convertor.in.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("convertor.out"));
while ((line = br.readLine()) != null){
allText += line;
}
list = allText.split("}");
//head = list[0];
for (String s : list[0].split(","))
bw.write(s.split(":")[0].split("\"")[1] + ",");
bw.newLine();
String[] aux;
String lista[] = allText.split(",");
int i, newL = list[0].split(",").length, len = allText.split(",").length;
for (i = 0; i < len; i ++){
// for (String s : str.split(",")){
aux = lista[i].split(":");
if (aux.length > 1)
{
if (aux[1].split("\"").length > 1)
bw.write(aux[1].split("\"")[1] + ",");
else
bw.write(aux[1].replaceAll(" ", "").replaceAll(",","") + ",");
}
//}
if ((i + 1) % newL == 0)
bw.newLine();
}
br.close();
bw.close();
}
}