(Swift) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
func chilkatTest() {
let fac = CkoFileAccess()!
// Note: Chilkat accepts either forward slash or backslash chars as directory separators..
print("\(fac.getDirectoryName("/MyDir/MySubDir/myfile.ext")!)")
print("\(fac.getDirectoryName("/MyDir/MySubDir")!)")
print("\(fac.getDirectoryName("/MyDir/")!)")
print("\(fac.getDirectoryName("/MyDir")!)")
print("\(fac.getDirectoryName("/")!)")
print("\(fac.getExtension("C:/mydir.old/myfile.ext")!)")
print("\(fac.getExtension("C:/mydir.old/")!)")
print("\(fac.getFileName("C:/mydir/myfile.ext")!)")
print("\(fac.getFileName("C:/mydir/")!)")
print("\(fac.getFileNameWithoutExtension("C:/mydir/myfile.ext")!)")
print("\(fac.getFileNameWithoutExtension("C:/mydir/")!)")
print("---")
}
|