• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

parsing csv file with multi lines and multi values

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

I'm experiencing issue while parsing an csv file. The purpose is to read multi lines with multi values.
Here's an example:

Grade: A; B; C; D
Group: james; roll; campbell
campus: a;b;c
campus: A;B;C

Group: Bob; kim; warm
campus: a;b;c
campus: A;B;C
.
.
if this match Group, it'll read the value of Group and those for the next 2 lines ( campus, campus ) and so one.

result:
Grade --> A;B;C;D
Group1 -> james;roll;campbell;a;b;c
Group2 --> Bob;kim;warm;A;B;C

Will I use switch inside a switch ? or while with if statement

Any suggestions ???

THKS


 
Saloon Keeper
Posts: 7585
176
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CSV isn't as trivial a file format as it first looks. If this was my problem, I'd use one of the CSV libraries listed in https://coderanch.com/how-to/java/AccessingFileFormats
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic