13,258,055 members (74,134 online)
Rate this:
See more:
`D:\nageswararao\dec-14-12-night\Alumini_App\Alumini_App\Resume\NN_dd.doc`

In the above path I need to find the last occurrence of '\' and from that I would like to divide the path in two two strings.
Posted 15-Dec-12 1:03am
ntitish1.9K
Updated 15-Dec-12 1:07am
v2
André Kraak 15-Dec-12 6:08am

DO NOT SHOUT when asking a question. When you use all capital letters it is seen as shouting on the Internet and considered rude. Next time when posting a question please use proper capitalization.
ntitish 15-Dec-12 6:09am

sorry, but i not mean that.............

Rate this:

## Solution 1

You can use the Path class[^] for this.

Use the GetFullPath Method[^] to retrieve the path and GetFileName Method[^] for the file name.
Both links to the methods contain examples you can use.
Espen Harlinn 16-Dec-12 6:12am

5'ed, as Path provides the required functionality :-D
Rate this:

## Solution 5

```string a = @"D:\nageswararao\dec-14-12-night\Alumini_App\Alumini_App\Resume\NN_dd.doc";
int lastIndex = a.LastIndexOf('\\');```
v2
Anuja Pawar Indore 17-Dec-12 0:57am

MaulikDusara 17-Dec-12 7:09am

Rate this:

## Solution 4

Hi,

```string strFilePath = @"D:\nageswararao\dec-14-12-night\Alumini_App\Alumini_App\Resume\NN_dd.doc";
MessageBox.Show( strFilePath.LastIndexOf('\\').ToString());```
Rate this:

## Solution 2

```string str = D:\nageswararao\dec-14-12-night\Alumini_App\Alumini_App\Resume\NN_dd.doc;   //will take input
string[] strArr = new string[];
int count = 0;
char[] splitchar = { ' ' };
strArr = str.Split(splitchar);//here u will get each word in array index now decide what u have to do```
v2

Top Experts
Last 24hrsThis month
 OriginalGriff 240 Jochen Arndt 130 Richard MacCutchan 120 Dave Kreskowiak 95 phil.o 85
 OriginalGriff 4,294 Karthik Bangalore 2,276 ppolymorphe 1,774 Dave Kreskowiak 1,606 Jochen Arndt 1,415