-1

I am in the difficult situation now where i need to make a parser to parse a formatted document from tekla to be processed in the database.

so on the .CSV i have this

,SMS-PW-BM31,,1,,,,287.9
,,SMS-PW-BM31,1,H350*175*7*11,SS400,5805,287.9
,------------,--------------,----,---------------,--------,------------,---------
,SMS-PW-BM32,,1,,,,405.8
,,SMSPW-H707,1,H350*175*7*11,SS400,6697,332.2
,,SMSPW-EN12,1,PLT12x175,SS400,500,8.2
,,SMSPW-EN14,1,PLT16x175,SS400,500,11
,------------,--------------,----,---------------,--------,------------,---------

That is the document generated from the tekla software. What i expect from the output is something like this

HEAD-MARK      COMPONENT-TYPE  QUANTITY  PROFILE        GRADE     LENGTH     WEIGHT 
SMS-PW-BM31                    1                                             287.9
SMS-PW-BM31    SMS-PW-BM31     1         H350*175*7*11  SS400     5805       287.9
SMS-PW-BM32                    1                                             405.8
SMS-PW-BM32    SMSPW-H707      1         H350*175*7*11  SS400     6697       332.2
SMS-PW-BM32    SMSPW-EN12      1         PLT12X175      SS400     500        8.2
SMS-PW-BM32    SMSPW-EN14      1         PLT16X175      SS400     500        11

How do i start from in Java ? the most complicated thing is distributing the head mark that separated by the '-'

Chriskonz
  • 199
  • 1
  • 3
  • 12

1 Answers1

-1

CSV format is quite simple, there is a column delimiter that is a comma(,) and a row delimiter that is a new line(\n). Some columns will be surrounded by quotes(") to contain column data but it looks like you wont have to worry about that given your current file.

Look at String.split and you will find your answer after a bit of pondering it.

ug_
  • 11,267
  • 2
  • 35
  • 52