Inquisitive Cocoa

14th January ‘10

NSString-EscapeHTMLCharacters

Another category on NSString. This one converts a string containing characters that are special to HTML into their HTML entities.

& becomes &
< becomes &lt;
> becomes &gt;
And so on..

It’s loosely based on a similar category in the Google Toolbox. It’s written with a bias towards simplicity rather than efficiency.. and it’s on GitHub: http://github.com/inquisitiveSoft/NSString-EscapeHTMLCharacters under the MIT License.

Cocoa, Objective-C, Source

Add your thoughts