Results 1 to 2 of 2

Thread: writing tab delimited files into an array

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2014
    Posts
    23

    writing tab delimited files into an array

    I have a text file called text.txt in the location C:\testfolder
    in this file there are four values separated by tab (chr(9)) values like so (note that (chr(9) represents a tab spacing and not actual text): test1(chr(9))test2(chr(9)test3(chr(9)test(4)

    I need a function that reads each value into an array by separating the values based on an encounter with a tab spacing i.e.
    egarray(0) = test1
    egarray(1) = test2
    egarray(2) = test3
    egarray(3) = test4

    thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: writing tab delimited files into an array

    If there's just one line in the file then I'd think that calling File.ReadAllText to read the file into a String and then calling Split on that String to create an array would be the way to go. You can pass ControlChars.Tab as an argument to String.Split.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width