简体   繁体   中英

How to edit record in txt file? What problem?

I have a text file containing the following:

id,name,quantity,entry price,final price
1 Televion 15 2000 2400
2 Car 9 200 240

I want to edit name or quantity but my code doesn't work. What should I do?

You must try using CSV files instead of simple text files. Given that you have data that can be represented in a table with attributes and values, it is best to make it into a CSV file. You can use OpenCSV and make this process easy. Get the OpenCSV jar file and import it to your file. This will make your task easier. You can get OpenCSV from here: http://opencsv.sourceforge.net/

You can find references to use it here: https://www.baeldung.com/opencsv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM