Pagini recente » Cod sursa (job #2933823) | Cod sursa (job #2305755) | Cod sursa (job #175699) | Cod sursa (job #2202660) | Cod sursa (job #1361478)
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"));
BufferedWriter bw = new BufferedWriter(new FileWriter("convertor.out"));
while ((line = br.readLine()) != null){
allText += line;
}
list = allText.split("}");
//head = list[0];
String deAfisat = "";
for (String s : list[0].split(","))
deAfisat+=(s.split(":")[0].split("\"")[1] + ",");
//bw.newLine();
deAfisat+=System.getProperty("line.separator");
String[] aux;
for (String str : list){
for (String s : str.split(",")){
aux = s.split(":");
if (aux.length > 1)
{
if (aux[1].split("\"").length > 1)
deAfisat+=(aux[1].split("\"")[1] + ",");
else
deAfisat+=(aux[1].replaceAll(" ", "").replaceAll(",","") + ",");
}
}
deAfisat+=System.getProperty("line.separator");
//bw.newLine();
}
bw.write(deAfisat);
br.close();
bw.close();
}
}