Posted By

zamza726 on 05/17/11


Tagged

filename extention


Versions (?)

divide filename and extention


 / Published in: Objective C
 

  1. - (NSString *) loadFilePath:(NSString *)fileName {
  2.  
  3. NSArray * rslt = [fileName componentsSeparatedByString:@"."];
  4. if ([rslt count]!=2) {
  5. return;
  6. }
  7. NSString * fileTitle = [rslt objectAtIndex:0];
  8. NSString * fileType = [rslt objectAtIndex:1];
  9.  
  10. NSString *filepath = [[NSBundle mainBundle] pathForResource:fileTitle ofType:fileType];
  11.  
  12. return filepath;
  13. }

Report this snippet  

You need to login to post a comment.