Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created Nov 8, 2008
Embed
What would you like to do?
- (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