62,614
社区成员
发帖
与我相关
我的任务
分享
String s1 = "2010-05-07,\"转账\",\"0\",\"00000000000000000\",\"某某公司\",\"2902002109023007384\",\"上交款\",\"3,000.00\",\"0.00\",\"46,440,431.60\"";
s1 = s1.replaceAll("(\"[\\d\\w]*[^\"]),([\\d\\w]*\\.\\d+\")", "$1$2");
s1 = s1.replace("\"", "");
s1 = s1.replace(",", ";");
System.out.println(s1);
public class LogAnalysisMain {
public static void main(String[] args) throws IOException {
String s1 = "2010-05-07,\"转账\",\"0\",\"00000000000000000\",\"某某公司\",\"2902002109023007384\",\"上交款\",\"3,000.00\",\"0.00\",\"46,440,431.60\"";
System.out.println(s1);
s1 = s1.replaceAll("(?:,(?=[0-9]{3}))+", "");
System.out.println(s1);
}
}
输出:
2010-05-07,"转账","0","00000000000000000","某某公司","2902002109023007384","上交款","3,000.00","0.00","46,440,431.60"
2010-05-07,"转账","0","00000000000000000","某某公司","2902002109023007384","上交款","3000.00","0.00","46440431.60"