Solved

Strip characters from address string

Posted on 2011-09-15
3
242 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

746 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