简体   繁体   English

我如何比较在 java 中没有标题格式和数据差异的 csv

[英]How do i compare csvs which don't have headers for format and data difference in java

I have a pair of similar CSV's without header rows.I have to compare them for format and data differences,how do I parse them so that i may know data type for the parsed string values.ie, I have to identify if the parsed string is a date or time or currency or normal string.Currently I am using Apache Commons CSV parser( without header constructor)but I am unable to compare the CSV's as I don't know which value corresponds to which type?please help.我有一对没有 header 行的类似 CSV。我必须比较它们的格式和数据差异,如何解析它们以便我可以知道解析字符串值的数据类型。即,我必须确定解析字符串是否是日期或时间或货币或普通字符串。目前我正在使用 Apache Commons CSV 解析器(没有 header 构造函数)但我不知道哪个值对应于 CSV 作为构造函数?

I would read the first line of each csv and use regular expressions to sort them into the different categories.我会阅读每个 csv 的第一行并使用正则表达式将它们分类到不同的类别中。 If you're not looking for a super clean way, you can maybe just check if certain special characters are contained within the string like the currency symbols and sort them out that way.如果您不是在寻找一种超级干净的方式,您可以只检查字符串中是否包含某些特殊字符(如货币符号)并以这种方式对它们进行排序。 If it doesnt have a currency symbol then it could be a date or normal string.如果它没有货币符号,那么它可能是日期或普通字符串。 If it doesnt have '-' either then it's a normal string.如果它也没有'-',那么它就是一个普通的字符串。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何生成Java中没有密钥代码的键盘事件? - How do I generate keyboard events that don't have key code in Java? 如何为 Java 库中没有 apply 方法的对象编写 JSON 格式? - How do I write a JSON Format for an object in the Java library that doesn't have an apply method? 如何获取 IST 格式的当前系统时间并将其与 HH:mm:ss 格式的时间(字符串数据类型)进行比较? java 语言的解决方案 - How do I get current system time in IST format and compare it to a time in HH:mm:ss format (which is in String datatype)? solution in java language 我必须用Java覆盖哪种方法才能使用“&gt;”来比较类的实例 - Which method do I have to overwrite in Java to use “>” to compare instances of my class 如果没有上下文该怎么办? - What to do if I don't have Context? 如何在java中获取没有字符串的最后两个字符的字符串的子字符串 - How to get substring of a string which don't have last two character of a string in java 我在java中调用一个我无法控制的方法。 如果我没有得到它的回应,我想要杀死它并继续前进 - I'm calling a method in java which I have no control of. If I don't get a response from it, I want to kill it and move on 如何告诉jackson忽略我无法控制源代码的属性? - How can I tell jackson to ignore a property for which I don't have control over the source code? 我如何比较从后端获取的数据列表&lt;&gt;与 Ui 元素 - How can i compare the list<>of data which i have fetched from backend to Ui elements 如何获取 java 中的自定义标头,该标头在 node js 中设置或由 nodejs 发送 - How do i fetch the custom headers in java which is set in node js or sent by nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM