// // CCFileName.m // CCFC // // Created by xichen on 11-12-23. // Copyright 2011 ccteam. All rights reserved. // #import "CCFileName.h" #import "CCCommon.h" #import "CCNSString.h" @implementation CCFileName @synthesize fileName = _fileName; - (id)initWithFileName:(NSString *)fileName { COMMON_INIT_BEGIN self.fileName = fileName; COMMON_INIT_END } - (void)dealloc { [_fileName release]; [super dealloc]; } // get the extend name of the fileName, xichen.txt, then returns txt - (NSString *)getExtendName { int index = [_fileName lastIndexOfChar:'.']; if(index == _fileName.length - 1) return @""; return [_fileName substringFromIndex:index + 1]; } // get the main file name of the fileName, xichen.txt, then returns xichen - (NSString *)getMainName { int index = [_fileName lastIndexOfChar:'.']; if(index == -1) return _fileName; return [_fileName substringToIndex:index]; } @end
googlecode链接地址(会有更新):http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCFileName.m
本文介绍了一个名为CCFileName.m的Objective-C文件实现细节,包括初始化、析构及获取文件名扩展名与主名称的方法。该文件由xichen创建于2011年12月23日,并属于ccteam团队。
77

被折叠的 条评论
为什么被折叠?



