编译CSV行
/* 来 自 nowjava - 时 代 Java*/ //package com.nowjava; public class Main { static String compileCSVLine(String[] fields, int i, String prefix) { String line = (prefix == null) ? "" : prefix; for (; i < fields.length; i++) { if (line.length() > 0) line = line + ","; String f = fields[i]; if (f.startsWith("\"") && f.endsWith("\"")) { f = f.substring(1, f.lastIndexOf('"')); f = f.replaceAll("\"", "'"); f = '"' + f + '"'; } else { /** 来 自 时 代 J a v a - nowjava.com **/ f = f.replaceAll("\"", "'"); } f = f.replaceAll(",", " "); if (f.contains(",") && !f.startsWith(