文章分类 -  J2EE

摘要: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]*"); return pattern.matcher(str).matc 阅读全文
posted @ 2013-04-02 06:59 日光之下无新事 阅读(186) 评论(0) 推荐(0)
摘要:Java:String substring(int beginIndex, int endIndex)C# :string.Substring (int startIndex, int length) 阅读全文
posted @ 2013-03-09 08:58 日光之下无新事 阅读(177) 评论(0) 推荐(0)
摘要:(double) (Math.round(sd3*10000)/10000.0); // 这样为保持4位(double) (Math.round(sd3*100)/100.0); // 这样为保持2位.2.另一种办法import java.text.DecimalFormat;// 第一个为2位,第二个为3位.DecimalFormat df2 = new DecimalFormat("###.00");DecimalFormat df2 = new DecimalFormat("###.000");System.out.println(df2.form 阅读全文
posted @ 2012-07-04 11:47 日光之下无新事 阅读(37473) 评论(0) 推荐(0)
摘要:参考网址:http://www.easywayserver.com/blog/java-how-to-read-xml-file/books.xml<?xml version="1.0" encoding="iso-8859-1"?><library> <book> <name>Head First Java, 2nd Edition</name> <author>Kathy Sierra and Bert Bates</author> <publication-d 阅读全文
posted @ 2012-07-04 10:51 日光之下无新事 阅读(285) 评论(0) 推荐(0)