divide filename and extention


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.