How can i remove the last part in a string

I have a dynamic generated string as /directory/folder/filename.html

How can i remove the last part i.e /filename.html.

I want my output as /directory/folder/.


Use the Path.GetDirectoryName method in System.IO:

string path = "/directory/folder/filename.html";
path = Path.GetDirectoryName(path);

This may change the path seperator to the system default. If you want to preserve the slashes, use the following instead:

path = path.Substring(0, path.LastIndexOf('/'));

Need Your Help

$each response and put it in a class

javascript jquery

I want done loop for response (three times loop), and i want append they in a .list but it don't work for me, (response have value in alert). what do i do?

Copying a column from one table to another

sql postgresql select sql-update

I have photos table onto which I'm trying to insert a new column from another table by filtering data with a WHERE clause. Here is the query I'm trying to execute: