Link to home
Start Free TrialLog in
Avatar of JMO9966
JMO9966

asked on

VB.Net string parsing question

I'm having trouble parsing this string.

I need to get rid of the filename part of the following string, everything to the right of the last "\".

C:\JB\CustData\csv\Neill.csv

I'm coding this with VB.Net

thanks,
JMO9966
SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Woops.  Yes, if he actually wants to get *rid* of the filename part, like he says in the question, instead of in the sentence that arrived in my mind...
You can also pass the filename to a new FileInfo instance and get the info from that:

        Dim fullPath As String = "C:\JB\CustData\csv\Neill.csv"
        Dim fi As New System.IO.FileInfo(fullPath)
        Dim fileName As String = fi.Name
        Dim filePath As String = fi.DirectoryName