Hi Guys ,
I have a line which is like this :-
"C:\\Users\\saurabh\\Desktop\\Projects\\Texts\\A Sign of the Times.txt"
how can i jus extract the last part of it which is
A Sign of the Times.

Thanks

Recommended Answers

All 4 Replies

Here pseudo code

Do streamreader untill null
{
    String readline = SreamLine;
}
MessageBox.Show(readline);

this is to reaqd the line.what i want to do is to get a substring froma sting.so if suppose i have string like C:\\Users\\saurabh\\Desktop\\Projects\\Texts\\A Sign of the Times.txt then i just want "A Sign of the Times" part of the string.Thanks for the help

I got it guys .This is what i was suppose to do

int coll = names[currentFile].LastIndexOf(@"\");
                string sub = names[currentFile].Substring(coll + 1);
                int coll2 = sub.LastIndexOf(@".");
                string sub2 = sub.Remove(coll2);
                item.article = sub2;

O sorry I see what happened.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.