Parse .txt to .csv

前端 未结 6 972
说谎
说谎 2020-12-21 06:56

Is it possible to create a Java program which recognizes the text in a .txt file and write it in a .csv file? If yes,how would you start with such a problem?

My .txt

6条回答
  •  渐次进展
    2020-12-21 07:20

    You first need to How do I create a Java string from the contents of a file?.

    Then you can take advantage of How to split a string in Java and use | as the delimiter.

    As the last step you can use the Joiner to create the final String and store it using How do I save a String to a text file using Java?.

提交回复
热议问题