Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

encodeURIComponent equivalent object-c

I'm having trouble googling this.

Does Objective-C have an equivalent method for encoding URI Component?

http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp

This seems to be a very common use case but I can't find any documentation about it in Objective-C.

Thanks.

like image 777
Trung Avatar asked Sep 17 '25 20:09

Trung


1 Answers

-[NSString stringByAddingPercentEscapesUsingEncoding:] is the simplest way to do this.

like image 86
Dave DeLong Avatar answered Sep 20 '25 12:09

Dave DeLong