Pagini recente » Cod sursa (job #357187) | Cod sursa (job #3168272) | Cod sursa (job #278937) | Cod sursa (job #1694721) | Cod sursa (job #1358363)
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) {
String line1 = null, line2 = null;
try{
// open input stream test.txt for reading purpose.
BufferedReader br = new BufferedReader(new FileReader("convertor.in"));
BufferedWriter bw = new BufferedWriter(new FileWriter("convertor.out"));
while ((line1 = br.readLine()).startsWith("}") == false) {
if (line1.startsWith("\""))
bw.write(line1.split(":")[0].split("\"")[1] + ",");
}
bw.newLine();
while ((line2 = br.readLine()) != null){
if (line2.startsWith("\"")){
if (line2.split(":")[1].split("\"").length > 1)
bw.write(line2.split(":")[1].split("\"")[1] + ",");
else
bw.write(line2.split(":")[1].split(" ")[1].replaceAll(",","") + ",");
}
if (line2.startsWith("}"))
bw.newLine();
}
br.close();
bw.close();
}catch(Exception e){
e.printStackTrace();
}
}
}