Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove extension of url in iPhone

What's the best way to remove the extension of an url in iPhone?

I was using [urlString stringByDeletingPathExtension] but I just realized that it replaces http:// with http:/ for some unknown reason. Most likely this method is for file paths, not urls.

like image 946
hpique Avatar asked Nov 24 '10 12:11

hpique


1 Answers

If the string operation reduces // to / (as a double slash does not make sense in a path), just use the URL counterpart, URLByDeletingPathExtension: on a NSURL object, which you create with [NSURL URLWithString:urlString].

like image 89
w-m Avatar answered Sep 21 '22 05:09

w-m