当前位置:网站首页>Read the qualified line of CSV file and write it to another CSV
Read the qualified line of CSV file and write it to another CSV
2022-07-24 06:10:00 【A little cute C】
// Read csv File and write another csv in
public static void readAndWrite(String readFile, String writeFile){
File csv = new File(writeFile); // In which file
try {
BufferedReader reader = new BufferedReader(new FileReader(readFile));// Which file to read from
reader.readLine();// The first line of information , For the title information , no need , if necessary , Comment out
String line = null;
// Line by line reading
while((line=reader.readLine())!=null){
String item[] = line.split(",");//CSV The format file is a comma separator file , It's divided by commas
//System.out.println(item);
double q= Double.parseDouble(item[1]);
// Here are the screening criteria
if((q >= 41275.0) && (q <= 41275.98)){// The number here represents time, i.e 2013/1/1 0:00 2013/1/1 24:00
String last = item[item.length-1];// This is the data you want
double w= Double.parseDouble(last);//int value = Integer.parseInt(last);// If it's an integer
BufferedWriter bw = new BufferedWriter(new FileWriter(csv,true)); // Additional write
bw.write(String.valueOf(w));
bw.newLine();// Line break
bw.close();
System.out.println(w);}
}
} catch (Exception e) {
e.printStackTrace();
}
}边栏推荐
- Learning rate optimization strategy
- Statistical learning methods (2nd Edition) Li Hang Chapter 22 summary of unsupervised learning methods mind mapping notes
- Typora 安装包2021年11月最后一次免费版本的安装包下载V13.6.1
- 字符串方法以及实例
- day5-jvm
- Jupyter notebook select CONDA environment
- JDBC advanced -- learning from Shang Silicon Valley (DAO)
- STM32 standard peripheral Library (Standard Library) official website download method, with 2021 latest standard firmware library download link
- Unity基础知识及一些基本API的使用
- day6-jvm
猜你喜欢
随机推荐
day5-jvm
Iotp2pgate two IOT devices point-to-point communication fast implementation scheme
Demo of UDP communication applied to various environments
Machine learning (Zhou Zhihua) Chapter 3 Notes on learning linear models
CRC-16 MODBUS code
HoloLens2开发:使用MRTK并且模拟眼动追踪
【深度学习】手把手教你写“手写数字识别神经网络“,不使用任何框架,纯Numpy
Opencv reads avi video and reports an error: number < Max_ number in function ‘icvExtractPattern
MySql下载,及安装环境设置
Statistical analysis of catering data --- Teddy cloud course homework
MySql与Qt连接、将数据输出到QT的窗口tableWidget详细过程。
JUC并发编程基础(9)--线程池
用指针访问二维数组
STM32 DSP库MDK VC5\VC6编译错误: 256, (const float64_t *)twiddleCoefF64_256, armBitRevIndexTableF64_256,
[principles of database system] Chapter 5 algebra and logic query language: package, extension operator, relational logic, relational algebra and datalog
数组常用方法
碰壁记录(持续更新)
QT char to qstring hexadecimal and char to hexadecimal integer
原生js放大镜效果
Qt 使用纯代码画图异常
![[activiti] group task](/img/f1/b99cae9e840d3a91d0d823655748fe.png)







