JAVA¶ÁÈ¡CSV
Ê×Ïȵ½¸Ãhttp://ostermiller.org/utils/download.html µØÖ·ÏÂÔØcom.Ostermiller.util cvsµÄjar°ü¡£
public class CsvFileParser{
private LabeledCSVParser csvParser;//csv½âÎöÆ÷£¬¶ÔÓÚµÚÒ»ÐеıíÍ·ÐÅÏ¢£¬×Ô¶¯¼ÓÔØΪË÷Òý¹Ø¼ü×Ö
private int currLineNum = -1;//ÎļþËù¶Áµ½ÐÐÊý
private String[] currLine = null;//ÓÃÀ´´æ·Åµ±Ç°ÐеÄÊý¾Ý
/*
* ¹¹Ô캯Êý£¬
* Param: in InputStream Òª½âÎöµÄÐÅÏ¢Á÷
* throws IOException
*/
protected CsvFileParser(InputStream in) throws IOException {
csvParser = new LabeledCSVParser(new ExcelCSVParser(in));
currLineNum = csvParser.getLastLineNumber();
/*
* ¼ì²éÊÇ·ñ»¹ÓÐÊý¾Ý
*
* return ture »¹ÓÐÒ»ÐÐÊý¾Ý£¬false ûÓÐÊý¾Ý
*/
public boolean hasMore() throws IOException {
currLine = csvParser.getLine();
currLineNum = csvParser.getLastLineNumber();
if (null == currLine)
return false;
return true;
}
/*
* ·µ»Øµ±Ç°ÐÐÊý¾Ý£¬¹Ø¼ü×ÖËùÖ¸ÏòµÄÊý¾Ý
* param:String filedName ¸ÃÐеıíÍ·
* return:String ·µ»Øµ±Ç°ÐÐÊý¾Ý£¬¹Ø¼ü×ÖËùÖ¸ÏòµÄÊý¾Ý
*/
public String getByFieldName(String fieldName) {
return csvParser.getValueByLabel(fieldName);
}
/*
* ¹Ø±Õ½âÎöÆ÷
*
*
*/
public void close() throws IOException {
csvParser.close();
}
/*
* ¶ÁÈ¡µ±Ç°ÐÐÊý¾Ý
*
* return String[] ¶ÁÈ¡µ±Ç°ÐÐÊý¾Ý
*/
public String[] readLine() throws IOException {
currLine = csvParser.getLine();
currLineNum = csvParser.getLastLineNumber();
return currLine;
}
public getCurrLineNum(){
return currLineNum;
}
public static void main(String[] args) throws Exception {
//´´½¨½âÎöÐÅÏ¢Á÷
InputStream in=new FileInputStream(new File("C:PerfLogsdata_000002.csv"));
//ʵÀý½âÎöÆ÷CsvFileParser
CsvFile
Ïà¹ØÎĵµ£º
Ò»£¬JavaÓïÑÔÖеĶÔÏóÒýÓÃ
C++ÖÐÖ¸ÕëºÍÒýÓüæÓУ¬¶øJavaÖÐûÓÐÖ¸ÕëµÄ¸ÅÄÍêÈ«ÓÃÒýÓÃÌæ´ú¡£ÈçC++ÖÐÒ»Ñù£¬ÒýÓÃÊÇÎÒÃǸø±äÁ¿µÄÒ»¸ö“±ðÃû”£¬Ò»¸ö±äÁ¿¿ÉÒÔÓжà¸ö“±ðÃû”¡£ÒýÓõÄÖµÊÇÒ»¸öÄÚ´æµØÖ·£¬ÔÚ¶ÔÏóµÄÒýÓñ»¶¨Òåʱ£¬È磺
String s; //´ËʱsֵΪ¿Õ£¬ÏµÍ³²¢Ã»ÓÐΪsËùÖ¸µÄ¶ÔÏó·ÖÅäÄÚ´æ
s = ......
java»·¾³±äÁ¿ÅäÖÃ
windows xpÏÂÅäÖÃJDK»·¾³±äÁ¿£º
1.°²×°JDK£¬°²×°¹ý³ÌÖпÉÒÔ×Ô¶¨Ò尲װĿ¼µÈÐÅÏ¢£¬ÀýÈçÎÒÃÇÑ¡Ôñ°²×°Ä¿Â¼ÎªD:\java\jdk1.5.0_08£»
¡¡ 2.°²×°Íê³Éºó£¬ÓÒ»÷“ÎҵĵçÄÔ”£¬µã»÷“ÊôÐÔ”£»
3.Ñ¡Ôñ“¸ß¼¶”Ñ ......
Ù¡Ç¿ http://blog.csdn.net/microtong
OakCMSÄÚÈݹÜÀíϵͳ http://www.oakcms.cn http://www.oakcms.net
Ò»Ôª¶þ´Î·½³Ìax2+bx+c=0£¬ÊäÈëa,b,cÈý¸öϵÊý£¬Çó½â·½³Ì£¬½á¹ûÓÐÈýÖÖÇé¿ö£ºÁ½¸öʵÊý¸ù¡¢Ò»¸öʵÊý¸ù¡¢Á½¸ö¸´Êý¸ù¡£
/**
* Equation.java
*/
package cn.edu.uibe.oop;
/**
* ¼ÆËã ......
ÔÚJavaÖз½·¨²ÎÊýµÄ´«µÝ£¬¶¼ÊÇÖµ´«µÝ£¬¶ÔÏó´«µÝÊǵØÖ· £¬»ù±¾Êý¾ÝÀàÐÍ´«µÝµÄÊÇÖµ¡£µØÖ·ºÍÖµ¶¼Öµ¡£
ÏÂÃæÒÔÒ»¸öÀý×ÓÀ´¿´ÄÚ´æÖеÄÊý¾Ý±ä»¯Çé¿ö
public class Test{
private String name;
public String getName(){
&nbs ......
´ó¼ÒºÃ£¬Çë°´ÕÕÏÂͼ¸ñʽÌîдÄãµÄ¼òÀú£¬·¢Ë͵½Óʼþ loveyingjiaping@126.com
¹«Ë¾×ܲ¿ÔÚº¼ÖÝÎ÷ºþ¿Æ¼¼Ô°¸½½ü£¬¸£Àû´ýÓöºÃ£¬ÎåÏÕÒ»½ð£¬
²¹Ìù£º·¹Ìù¡¢½»Í¨·Ñ¡¢Í¨Ñ¶·Ñ¡¢ÄêÖÕ½±¡¢¹ý½Ú·Ñ……
±±¾©·Ö¹«Ë¾¼¼Êõ²¿¾Àí£¨¸±¾Àí£©¸ÚλְÔðºÍÈÎÖ°Ìõ¼þÈçÏ£º
n ¸ÚλְÔð£º
1. & ......