Parsing text files

  • Thread starter Thread starter Justin Fancy
  • Start date Start date
J

Justin Fancy

Hi Everyone,

I am creating a vb.net application, and i'm almost done. Except for one
problem. I need to be able to change this output:

C:\Documents and Settings\fancyj\My Documents\Visual Studio
Projects\FileDifferencing\bin\Comparison.ldb

into a format that is in another file:

/VisualStudioProjects/FileDifferencing/bin/Comparison.ldb

So, basically I want to cut the leading folders and include only the
subfolder off of the root.

Any suggestions?
 
If the start of the path is the official My Documents folder for the user,
you could try something like this.

Dim sourcePath As String
Dim destPath As String

sourcePath = "C:\Documents and Settings\fancyj\My Documents\Visual
Studio Projects\FileDifferencing\bin\Comparison.ldb"
destPath = Replace(sourcePath, My.Computer.FileSystem.SpecialDirectories.MyDocuments,
"")
destPath = Replace(destPath, "\", "/")
 
Justin Fancy said:
I am creating a vb.net application, and i'm almost done. Except for one
problem. I need to be able to change this output:

C:\Documents and Settings\fancyj\My Documents\Visual Studio
Projects\FileDifferencing\bin\Comparison.ldb

into a format that is in another file:

/VisualStudioProjects/FileDifferencing/bin/Comparison.ldb

So, basically I want to cut the leading folders and include only the
subfolder off of the root.

In addition to the other reply, check out the shared methods of
'System.IO.Path' and the 'System.Uri' class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top