• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Strip characters from address string

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
stoneycurtis
Asked:
stoneycurtis
  • 2
1 Solution
 
pivarCommented:
Hi,

Try

Path.GetFileNameWithoutExtension(fileName)

/peter
0
 
pivarCommented:
You'll find Path in System.IO
0
 
stoneycurtisAuthor Commented:
Perfect - Thank You
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now