Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,466
    Thanks
    15
    Thanked 0 Times in 0 Posts

    read file separated by tab

    I have a file that has 2 collumns separated by a tab.
    i want to convert this to an html table
    how would I read a line and separate it that it's
    <tr><td>coll 1 </td><td>col2</td></tr> for each line
    my file is col1 tab col2 now

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    In ASP, you can use the Scripting.FileSystemObject to search the file for chr(9) (tab) and vbCrLf (Carriage Return, Line Feed), then do a replace.
    Last edited by Daemonspyre; 07-05-2007 at 03:17 PM.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Regular Coder hinch's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    923
    Thanks
    25
    Thanked 80 Times in 80 Posts
    the replace string would be something like
    outputvar = "<tr><td>"
    while readline whatever not EOF
    outputvar=outputvar & replace(readintextfilecontents,vbTab,"</td><td>")
    outputvar=outputvar & replace(readintextfilecontents,vbCRLF,"</td></tr>")
    end while

    something like that anyway (my god its been years since i've done asp )
    A programmer is just a tool which converts caffeine into code

    My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
    My hobby: http://www.angel-computers.co.uk
    My life: http://www.furious-angels.com


  •  

    Posting Permissions

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