(Go) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
fac := chilkat.NewFileAccess()
// Note: Chilkat accepts either forward slash or backslash chars as directory separators..
fmt.Println(*fac.GetDirectoryName("/MyDir/MySubDir/myfile.ext"))
fmt.Println(*fac.GetDirectoryName("/MyDir/MySubDir"))
fmt.Println(*fac.GetDirectoryName("/MyDir/"))
fmt.Println(*fac.GetDirectoryName("/MyDir"))
fmt.Println(*fac.GetDirectoryName("/"))
fmt.Println(*fac.GetExtension("C:/mydir.old/myfile.ext"))
fmt.Println(*fac.GetExtension("C:/mydir.old/"))
fmt.Println(*fac.GetFileName("C:/mydir/myfile.ext"))
fmt.Println(*fac.GetFileName("C:/mydir/"))
fmt.Println(*fac.GetFileNameWithoutExtension("C:/mydir/myfile.ext"))
fmt.Println(*fac.GetFileNameWithoutExtension("C:/mydir/"))
fmt.Println("---")
fac.DisposeFileAccess()
|