当前位置:网站首页>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)
边栏推荐
- 3种圆形按钮悬浮和点击事件
- 华为设备配置VRRP与BFD联动实现快速切换
- XSS practice - cycle and two cycle problem at a time
- C. Array Elimination-- Codeforces Round #751 (Div. 2)
- 好朋友离职了,一周面试了20多场,我直呼内行
- Android build error: Plugin with id ‘kotlin-android‘ not found.
- XSS holes emersion
- From September 1st, my country has granted zero-tariff treatment to 98% of tax items from 16 countries including Togo
- Soft exam system analysts note experience sharing: theory of protracted war
- 用 setTimeout 来实现 setInterval
猜你喜欢
随机推荐
【kali-漏洞扫描】(2.1)Nessus下载安装(上)
C. Keshi Is Throwing a Party- Codeforces Global Round 17
史兴国对谈于佳宁:从经济模式到落地应用,Web3的中国之路怎么走?
XSS practice - cycle and two cycle problem at a time
PyCharm函数自动添加注释无参数问题
模板字符串
收藏-即时通讯(IM)开源项目OpenIM-功能手册
分分钟教你读取 resources 目录下的文件路径
gtk实现图片旋转
有趣的opencv-记录图片二值化和相似度实现
今晚直播 | 8.2-8.4 与你聊聊开源与就业那些事!
XSS testing
Linux操作Jmeter(附带:关于连接上redis无法进行写入操作的问题),JMeter配置多用户进行压力测试
E - Swap
canvas螺旋动画js特效
XSS线上靶场---Warmups
B. Paranoid String
编译器工程师眼中的好代码(1):Loop Interchange
剑指 Offer 07. 重建二叉树
[kali-vulnerability scanning] (2.1) Nessus lifts IP restrictions, scans quickly without results, and plugins are deleted (middle)









