Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created November 8, 2008 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tolmasky/23136 to your computer and use it in GitHub Desktop.
Save tolmasky/23136 to your computer and use it in GitHub Desktop.
- (CPString)stringByDeletingLastPathComponent
{
var path = self,
start = length - 1;
while (path.charAt(start) === '/')
start--;
path = path.substr(0, path.lastIndexOf('/', start));
if (path === "" && charAt(0) === '/')
return '/';
return path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment