Solved

Strip characters from address string

Posted on 2011-09-15
3
245 Views
Last Modified: 2012-05-12
Hello,
I'm passing a string variable to a text box for later use. The string is a file path and I want to strip away everything to the left of the last "\" (&#47). I've already used TrimEnd() to remove the file extension from the string, but I'm stuck on how to remove everything except the actual file name.
In case I'm not making myself clear...
change
 C:\Owner\MyDocuments\SomeFolder\myFolder
to
 myFolder
Thanks for any help or suggestions.
0
Comment
Question by:stoneycurtis
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
pivar earned 500 total points
ID: 36546017
Hi,

Try

Path.GetFileNameWithoutExtension(fileName)

/peter
0
 
LVL 22

Expert Comment

by:pivar
ID: 36546020
You'll find Path in System.IO
0
 

Author Closing Comment

by:stoneycurtis
ID: 36546109
Perfect - Thank You
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now