(C#) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
Chilkat.FileAccess fac = new Chilkat.FileAccess();
// Note: Chilkat accepts either forward slash or backslash chars as directory separators..
Debug.WriteLine(fac.GetDirectoryName("/MyDir/MySubDir/myfile.ext"));
Debug.WriteLine(fac.GetDirectoryName("/MyDir/MySubDir"));
Debug.WriteLine(fac.GetDirectoryName("/MyDir/"));
Debug.WriteLine(fac.GetDirectoryName("/MyDir"));
Debug.WriteLine(fac.GetDirectoryName("/"));
Debug.WriteLine(fac.GetExtension("C:/mydir.old/myfile.ext"));
Debug.WriteLine(fac.GetExtension("C:/mydir.old/"));
Debug.WriteLine(fac.GetFileName("C:/mydir/myfile.ext"));
Debug.WriteLine(fac.GetFileName("C:/mydir/"));
Debug.WriteLine(fac.GetFileNameWithoutExtension("C:/mydir/myfile.ext"));
Debug.WriteLine(fac.GetFileNameWithoutExtension("C:/mydir/"));
Debug.WriteLine("---");
|