資源簡介
重新編譯程序,可以運行在 JDK 1.6 環境下,程序中有很多測試點,如 多 sheet 操作,自定義函數, 數據格式化等,導出直接運行
代碼片段和文件信息
import?java.math.BigDecimal;
import?java.text.DecimalFormat;
import?java.text.DecimalFormatSymbols;
import?java.util.regex.Matcher;
import?java.util.regex.Pattern;
/**
?*?
?*/
/**
?*?@author?zwb?
?*?@date?2017年7月18日
?*/
public?class?test?{
public?static?void?main(String?args[])
{
String?str=“201706“;
System.out.println(str.substring(0?4));
System.out.println(str.substring(4).startsWith(“0“));
int?i=Integer.parseInt(str);
System.out.println(i);
BigDecimal???bd???=???new???BigDecimal(“3.14159265“);???
float?price=Float.parseFloat(“00000123“);
System.out.println(price);
DecimalFormat?decimalFormat=new?DecimalFormat(“.000“);//構造方法的字符格式這里如果小數不足2位會以0補足.
String?p=decimalFormat.format(price);//format?返回的是字符串
System.out.println(p);
??bd???=???bd.setScale(0BigDecimal.ROUND_HALF_UP);???
??System.out.println(bd);
??
??
??DecimalFormat?df8?=?new?DecimalFormat();??
??int?number?=?123456789;??
??//?設置三個一組??
??df8.setGroupingSize(3);??
??DecimalFormatSymbols?dfs?=?DecimalFormatSymbols.getInstance();??
??//?設置小數字分隔符??
??dfs.setDecimalSeparator(‘.‘);??
??dfs.setGroupingSeparator(‘‘);??
??
??df8.setDecimalFormatSymbols(dfs);?? ??
??System.out.println(df8.format(2220.20222));??
??df8.setGroupingUsed(false);??
??System.out.println(df8.format(2220.20222));?
??
??
??System.out.println(isNumeric(“好的好的回電話“));?
}
//返回?0?不是數字,1?整數?,2?浮點小數
public?static?int?isNumeric(String?str){?
???int?ret?=?0;
???Pattern?pattern?=?Pattern.compile(“-?[0-9]+.?[0-9]+“);?
???Matcher?isNum?=?pattern.matcher(str);
???if(?!isNum.matches()?){
???ret?=?0;
???????return?ret;?
???}
???if(str.indexOf(“.“)?!=?-1)
???{
???ret?=?2;
???}else
???{
???ret?=?1;
???}
???return?ret;?
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1093??2017-07-12?11:44??JexcelTemple\.classpath
?????文件???????1195??2017-07-12?11:44??JexcelTemple\.project
?????文件????????522??2017-07-12?11:44??JexcelTemple\.settings\.jsdtscope
?????文件????????670??2017-07-17?14:25??JexcelTemple\.settings\org.eclipse.jdt.core.prefs
?????文件????????495??2017-07-12?11:44??JexcelTemple\.settings\org.eclipse.wst.common.component
?????文件????????414??2017-07-12?11:44??JexcelTemple\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2017-07-12?11:44??JexcelTemple\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2017-07-12?11:44??JexcelTemple\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件?????????66??2017-07-12?11:44??JexcelTemple\.tern-project
?????文件??????25088??2017-07-21?10:16??JexcelTemple\ob
?????文件???????3139??2017-07-20?15:54??JexcelTemple\src\common\utils\JxlsUtils.java
?????文件???????1226??2017-07-17?17:53??JexcelTemple\src\jxls\demo\guide\Employee.java
?????文件???????2383??2017-07-21?10:18??JexcelTemple\src\jxls\demo\guide\ob
?????文件??????59392??2017-07-17?11:27??JexcelTemple\src\jxls-template\ob
?????文件???????1241??2017-07-17?11:27??JexcelTemple\src\log4j.properties
?????文件???????2014??2017-07-21?10:52??JexcelTemple\src\test.java
?????文件????????834??2017-07-12?11:44??JexcelTemple\WebRoot\index.jsp
?????文件?????????39??2017-07-12?11:44??JexcelTemple\WebRoot\me
?????文件???????4720??2017-07-21?14:04??JexcelTemple\WebRoot\WEB-INF\classes\common\utils\JxlsUtils.class
?????文件???????4869??2017-07-21?14:04??JexcelTemple\WebRoot\WEB-INF\classes\jxls\demo\guide\CCBB.class
?????文件???????1634??2017-07-21?14:04??JexcelTemple\WebRoot\WEB-INF\classes\jxls\demo\guide\Employee.class
?????文件???????3197??2017-07-21?14:04??JexcelTemple\WebRoot\WEB-INF\classes\jxls\demo\guide\ob
?????文件????????281??2017-07-21?14:04??JexcelTemple\WebRoot\WEB-INF\classes\jxls\demo\guide\SPQQKHJG.class
?????文件??????59392??2017-07-17?11:27??JexcelTemple\WebRoot\WEB-INF\classes\jxls-template\ob
?????文件???????1241??2017-07-17?11:27??JexcelTemple\WebRoot\WEB-INF\classes\log4j.properties
?????文件???????2575??2017-07-21?14:04??JexcelTemple\WebRoot\WEB-INF\classes\test.class
?????文件?????267634??2017-07-21?13:59??JexcelTemple\WebRoot\WEB-INF\lib\commons-jexl-2.1.1.jar
?????文件??????61829??2017-07-21?13:59??JexcelTemple\WebRoot\WEB-INF\lib\commons-logging-1.2.jar
?????文件??????31605??2017-07-21?13:59??JexcelTemple\WebRoot\WEB-INF\lib\commons-logging.jar
?????文件?????720702??2017-07-21?13:59??JexcelTemple\WebRoot\WEB-INF\lib\jxl-2.6.6.jar
............此處省略36個文件信息
評論
共有 條評論