(Objective-C) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
#import <CkoFileAccess.h>
CkoFileAccess *fac = [[CkoFileAccess alloc] init];
// Note: Chilkat accepts either forward slash or backslash chars as directory separators..
NSLog(@"%@",[fac GetDirectoryName: @"/MyDir/MySubDir/myfile.ext"]);
NSLog(@"%@",[fac GetDirectoryName: @"/MyDir/MySubDir"]);
NSLog(@"%@",[fac GetDirectoryName: @"/MyDir/"]);
NSLog(@"%@",[fac GetDirectoryName: @"/MyDir"]);
NSLog(@"%@",[fac GetDirectoryName: @"/"]);
NSLog(@"%@",[fac GetExtension: @"C:/mydir.old/myfile.ext"]);
NSLog(@"%@",[fac GetExtension: @"C:/mydir.old/"]);
NSLog(@"%@",[fac GetFileName: @"C:/mydir/myfile.ext"]);
NSLog(@"%@",[fac GetFileName: @"C:/mydir/"]);
NSLog(@"%@",[fac GetFileNameWithoutExtension: @"C:/mydir/myfile.ext"]);
NSLog(@"%@",[fac GetFileNameWithoutExtension: @"C:/mydir/"]);
NSLog(@"%@",@"---");
|