On Sat, 25 Jun 2005 02:15:38 +0400, "Kostya Ergin"
<ko****@erginsoft.com> wrote:
In Delphi there was a function ExtractFilePath(path). I searched in MSDN and
have not found. Somebody knows?
It seems that I as a Delphi programmer am not the only one struggling
with these kind of questions. I would love to read the book "C# for
Delphi developers", wouldn't you?
GetDirectoryName Returns the directory information for the specified
path string.
string fileName = @"C:\mydir\myfile.ext";
string path = @"C:\mydir\";
string rootPath = @"C:\";
string directoryName;
directoryName = Path.GetDirectoryName(fileName);
Console.WriteLine("GetDirectoryName('{0}') returns '{1}'",
fileName, directoryName);
directoryName = Path.GetDirectoryName(path);
Console.WriteLine("GetDirectoryName('{0}') returns '{1}'",
path, directoryName);
directoryName = Path.GetDirectoryName(rootPath);
Console.WriteLine("GetDirectoryName('{0}') returns '{1}'",
rootPath, directoryName);
Cheers,
chris