当前位置:网站首页>How to deal with commas in the content of the CSV file of the system operation and maintenance series
How to deal with commas in the content of the CSV file of the system operation and maintenance series
2022-08-03 21:17:00 【Lang Xiaolin】
Problem description:
The CSV file is comma-separated by default, but if the content contains commas, the separation will fail or the array subscript matching will be out of bounds.
Processing method:
(1) Regular expression
//(?=pattern)//Non-acquisition match, positive pre-check, match the search string at the beginning of any string matching pattern, the match does not need to be acquired for later use//(?:pattern) //Non-acquisition match, matches pattern but does not obtain the matching result, and does not store it for later use.This is useful when using the or character "(|)" to combine parts of a pattern.For example "industr(?:y|ies)" is a shorter expression than "industry|industries"//Split commas not enclosed by double quotesline.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)")(2) Use a third-party jar
<dependency><groupId>com.opencsv</groupId><artifactId>opencsv</artifactId><version>4.4</version></dependency>References:
https://blog.csdn.net/wls_2019/article/details/123225335 Special cases (comma) in reading and writing csv files
https://www.cnblogs.com/allen2333/p/9835654.html Regular Expression - (?!), (?, (?=)
https://blog.csdn.net/superbeyone/article/details/83624241 Java reads CSV file (CSVThe file data content contains comma processing)
边栏推荐
- Cross-end development technical reserve record
- 《QDebug 2022年7月》
- 通关剑指 Offer——剑指 Offer II 009. 乘积小于 K 的子数组
- 聚焦开源与联合共创|麒麟软件出席开源峰会欧拉分论坛
- LeetCode_位数统计_中等_400.第 N 位数字
- LeetCode_Digit Statistics_Medium_400. Nth Digit
- 15 years experience in software architect summary: in the field of ML, tread beginners, five hole
- NAACL 2022 | 具有元重加权的鲁棒自增强命名实体识别技术
- XSS测试
- 函数,递归以及dom简单操作
猜你喜欢

LyScript 实现应用层钩子扫描器

伪标签汇总

手动输入班级人数及成绩求总成绩和平均成绩?

svg胶囊药样式切换按钮

idea2021配置svn报错Cannot run program “svn“ (in directory “xxx“):CreateProcess error=2,系统找不到指定的文件

XSS线上靶场---haozi

Engineering Effectiveness Governance for Agile Delivery

XSS测试

XSS testing

解决npm -v查看npm版本出现npm WARN config global `--global`, `--local` are deprecated. Use `--location报错
随机推荐
LeetCode_位数统计_中等_400.第 N 位数字
开源一夏 |如何优化线上服务器
Engineering Effectiveness Governance for Agile Delivery
TweenMax.js向日葵表情变化
测试2年6.5K,每天“911”,我的心酸经历只有我自己知道···
StoneDB 开源社区月刊 | 202207期
基于DMS的数仓智能运维服务,知多少?
LitJson报错记录
迪赛智慧数——柱状图(多色柱状图):2021年我国城市住户存款排名
Use setTimeout to realize setInterval
太香了! 阿里 Redis 速成笔记, 从头到尾全是精华!
1 秒完成授权,Authing 全新上线一键登录功能
AI首席架构师13-AICA-智能文档分析技术在行业场景中的应用
XSS holes emersion
研究Fabric中Etcd的Raft应用
七夕快乐!
461. 汉明距离
独立站卖家在哪些平台做社交媒体营销效果最好?
ES6 - Arrow Functions
ES、Kibana 8.0安装