How to parse this data given in raw text format? The format of the data is : PER
ID: 3758625 • Letter: H
Question
How to parse this data given in raw text format?
The format of the data is :
PERSONAL INFO :
Name : John Doe
Age: 25Y
Address: XYZ Street
COMPLAINT:
Complaint topic: Can't get cable access.
Complaint level: A
CABLE OPERATOR:
Operator Name : Doe John
Operator Contact : 12345
STATE:
abcd
COUNTRY:
efgh
I want to convert this data into key:value format .After parsing I should have the keys Name or Age or State or Country and the respective Name value or Age Value should be associated with the keys.
I heard about config parser but I am not sure how to proceed with it. A little help would be great.I am using JAVA.
Explanation / Answer
The structure is more or less defined. Ambuguity may sometimes be, though, case number of fields in each line of information may be different, sometimes there may not be some block of data, and the number of lines in each block may vary as well.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.