• Koen Verbeeck (7/16/2014)


    1. You read the line and store it inside a string.

    2. You read the first 3 characters and depending on the result, you decide what to do.

    - if it's STN, you know a new row has stared

    - if it's DN, LOC or OPT, you need to parse the line.

    You can use the .NET split function for that.

    You need to use probably the space as a delimiter.

    - The result of the split function is an array of strings. Loop over this array and write each occurence to a variable.

    Throw away DN, LOC or OPT in the process.

    - Read the next line. If it is STN, you know you have processed a full row and you can write it to the output.

    3. Repeat step 2 until all lines have been processed.

    Thank you so much. You have helped a lot!

    Just one more thing, there is some cases in which there are some values that should be on the same line as OPT but are the next row like for instance 'CFAN !TKD' e.g. below. Would be able to assist or provide a hint on how I could get those values onto the same row as, merge with those values with OPT?

    Thank you.

    Eg,

    STN

    DN 326 0000

    LOC GHUT ILCE 01 2 12 01

    OPT CFW 1MR DGT RTP 0 ALTO NACT AWS NACT !NPA CFB CFD ENQC

    CFAN !TKD

    The Result would be:

    STN

    DN 326 0000

    LOC GHUT ILCE 01 2 12 01

    OPT CFW 1MR DGT RTP 0 ALTO NACT AWS NACT !NPA CFB CFD ENQC CFAN !TKD