Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Strip characters from address string

Posted on 2011-09-15
3
Medium Priority
?
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
pivar earned 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

730 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