Skip to content

Instantly share code, notes, and snippets.

@maddox
Created March 19, 2009 05:29
Show Gist options
  • Save maddox/81610 to your computer and use it in GitHub Desktop.
Save maddox/81610 to your computer and use it in GitHub Desktop.
//
// NSURL+Filename.h
// Pyrot
//
// Created by Jon Maddox on 3/19/09.
// Copyright 2009 Mustache, Inc.. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSURL (Filename)
- (NSString *)filename;
@end
//
// NSURL+Filename.m
// Pyrot
//
// Created by Jon Maddox on 3/19/09.
// Copyright 2009 Mustache, Inc.. All rights reserved.
//
#import "NSURL+Filename.h"
@implementation NSURL (Filename)
- (NSString *)filename{
NSArray *components = [[self path] componentsSeparatedByString:@"/"];
return [components objectAtIndex:[components count]-1];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment