Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. delimiters using VB.net

delimiters using VB.net

Scheduled Pinned Locked Moved Visual Basic
csharphelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ccandler
    wrote on last edited by
    #1

    I have a file which is seperated into fields by a comma for each field. I am trying to read the file into some type of structure but am unable to get past the point of reading upto the comma and then storing that away and then going back and reading the next field. Any help would be appreciated.

    C I 2 Replies Last reply
    0
    • C ccandler

      I have a file which is seperated into fields by a comma for each field. I am trying to read the file into some type of structure but am unable to get past the point of reading upto the comma and then storing that away and then going back and reading the next field. Any help would be appreciated.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      For each line that you read in use split(',') on the string. The returned value will be an array of strings, each representing one field. --Colin Mackay--

      "In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)

      1 Reply Last reply
      0
      • C ccandler

        I have a file which is seperated into fields by a comma for each field. I am trying to read the file into some type of structure but am unable to get past the point of reading upto the comma and then storing that away and then going back and reading the next field. Any help would be appreciated.

        I Offline
        I Offline
        Ian Darling
        wrote on last edited by
        #3

        I assume you have some sort of CSV (Comma Separated Values) file, with a record on each line. Look into: * FileStream and StreamReader classes * StreamReader.ReadLine() Function * Split() Function on MSDN. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky

        C 1 Reply Last reply
        0
        • I Ian Darling

          I assume you have some sort of CSV (Comma Separated Values) file, with a record on each line. Look into: * FileStream and StreamReader classes * StreamReader.ReadLine() Function * Split() Function on MSDN. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky

          C Offline
          C Offline
          ccandler
          wrote on last edited by
          #4

          I have broken appart the file by using the split function but now have an issue with the carriage returns. The values from the last field of the line is put with the first field of the next line?

          I 1 Reply Last reply
          0
          • C ccandler

            I have broken appart the file by using the split function but now have an issue with the carriage returns. The values from the last field of the line is put with the first field of the next line?

            I Offline
            I Offline
            Ian Darling
            wrote on last edited by
            #5

            ccandler wrote: I have broken appart the file by using the split function but now have an issue with the carriage returns. The values from the last field of the line is put with the first field of the next line? :confused: Now I'm confused. You mean that each line of the file doesn't represent a full record, and that a record can overlap lines of the file? Maybe you could provide some sample data and information about the file format? A straight CSV would be readable the way suggested. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups