package com.sinosoft.pz.system;
import com.alibaba.fastjson.JSON;
import com.google.gson.JsonArray;
import com.rapidark.framework.commons.util.JSONUtil;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class aaa {
public static void main(String[] args) {
try {
List<String> list = aaa.readFile("E:\\Program Files\\feiq\\Recv Files\\c.txt");
int i = 1;
for (String s : list) {
String[] split = s.split("\t");
System.out.println("('" +i+"','"+split[0]+"','"+split[1]+"','"+split[2]+"'),");
i++;
// System.out.println(new String(s.getBytes(), "UTF-8").trim());
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static List<String> readFile(final String filename) throws IOException {
List<String> filecon = new ArrayList<String>();
String m = "";
BufferedReader file = new BufferedReader(new FileReader(filename));
while ((m = file.readLine()) != null) {
if (!m.equals("0")) //文本结束的标志
{
if (!m.equals("")) //不需要读取空行
{
// System.out.println(new String(m.getBytes(), "UTF-8"));
// String regEx = "网站名称为*";
// boolean result = Pattern.compile(regEx).matcher(new String(m.getBytes(), "UTF-8")).find();
// if(result){
filecon.add(m);
// }
}
}
}
file.close();
return filecon;
}
}
网友评论