先下载:http://pinyin4j.sourceforge.net/ public class CnToPy { //将汉字转换为全拼 public static String getPingYin(String src){ char[] t1 = null; t1=src.toCharArray(); String[] t2 = new String[t1.length]; HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat(); t3.setCaseType(Ha ...
public static String addDate(String day,int x) { Date date = null; try { date = sdf.parse(day); } catch (ParseException ex) { ex.printStackTrace(); } if (date==null) return ""; ...
1用JAVA自带的函数 public static boolean isNumeric(String str){ for (int i = str.length();--i>=0;){ if (!Character.isDigit(str.charAt(i))){ return false; } } return true; } 2用正则表达式 public static boolean isNumeric(String str){ Pattern pattern = Pattern.compile("[0-9]*"); ret ...