package cn.usst.DataTest4; public class DataTest4 { /** * 将字符串“2014-09-29 14:35:36” 转换成“20140929143536” * @param args */ public static void main(String[] args) { String str = "2014-09-29 14:35:36"; String str2 = ""; String[] result = str.split("\\D"); for(int i=0; i<result.length; i++){ System.out.println(result[i]); str2 += result[i]; } System.out.println(str2); } }原文链接:https://www.f2er.com/regex/361247.html