strings question

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,
I got a string imput which looks like this:

c://abc//dfg//jjj//hh.txt

I want to fetch the file name of such input each time : to get hh.txt
from the string. What is the best code manipulation for doing that?
 
Hi,

The best way to do it is something like this:
string fileName =System.IO.Path.GetFileName("c://abc//dfg//jjj//
hh.txt");

Mario
GemBox Software
 
System.IO.Path has well-tested methods for this type of thing; for
example Path.GetFileName(...)

Marc
 
Hello,
I got a string imput which looks like this:

c://abc//dfg//jjj//hh.txt

I want to fetch the file name of such input each time : to get hh.txt
from the string. What is the best code manipulation for doing that?

*** Sent via Developersdexhttp://www.developersdex.com***

To extract the filename component of a path you can use
Path.GetFileName()

now, that strnig does not look like a path at all !!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top