Solved

Strip characters from address string

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio 2013 and Eclipse Neon 6 35
ASP.NET MVC 2 31
vb.net help 4 29
Alert on Server memory 2 19
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…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

786 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