oc-Foundation框架-NSString-常用方法-路径相关-拓展名

  NSString *path=@"/users/liyang/desktop/liyang.txt";
   NSLog(@"%@",[path pathExtension]);//返回路径的拓展名
NSString *path=@"/users/liyang/desktop/liyang.txt";
   NSLog(@"%@",[path stringByDeletingPathExtension]);//删掉拓展名
 NSString *path=@"/users/liyang/desktop/liyang.txt";
   NSLog(@"%@",[path stringByAppendingPathExtension:@"docr"]);//拼接一个拓展名

 

posted @ 2014-03-20 23:24  离子  阅读(136)  评论(0编辑  收藏  举报