It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming ASP & ASP.NET Forum

StreamWriter Writeline in Asp.Net

StreamWriter Writeline in Asp.Net

Postby alpizzle on Wed Apr 23, 2008 11:35 am

Hi everyone. I am using a streamwriter in asp.net to write the contents of a tex file into a new text file. I am having trouble getting the irght results though. Here is the line I am trying to copy:

"Label"="Shelf 3 D/A B"

I need to copy the "Shelf 3 D/A B" from that line, without the quotation marks. The format for the entire file is like this, so I can say start copying at the 10th position for example. But nothing I try is working. I have
Code: Select all
writer.WriteLine(phNumber & " " & (strLine1))
which copies the whole line. but I need everything from the ""S" to the end of the line -1 or - the "

Any help would be appreciated greatly.
Thanks
alpizzle
 
Posts: 3
Joined: Tue Apr 08, 2008 1:21 pm

Postby alpizzle on Wed Apr 23, 2008 11:55 am

Okay I am closer, just need a little help in the rest current code I have is

Code: Select all
writer.WriteLine(phNumber & " " & strLine1.Substring(strLine1.IndexOf(" ") + 1, strLine1.Length - strLine1.IndexOf(" ") - 2))


Which produces :

158 3 D/A B

This is desired except that it cuts off the first word, in this case "Shelf" If I try to add anything other than a " " to indexof at the beginning I get errors.
alpizzle
 
Posts: 3
Joined: Tue Apr 08, 2008 1:21 pm


Who is online

Users browsing this forum: No registered users and 0 guests