Sample code for 30+ languages & platforms
Objective-C

Convert HTML to plain-text

See more HTML-to-XML/Text Examples

Demonstrates how to convert HTML to plain-text.

Chilkat Objective-C Downloads

Objective-C
#import <CkoHtmlToText.h>
#import <NSString.h>

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

CkoHtmlToText *h2t = [[CkoHtmlToText alloc] init];

// Set the HTML:
NSString *html = 0;
html = @"<html><body><p>This is a test.</p><blockquote>Here is text within a blockquote</blockquote></body></html>";

NSString *plainText = 0;

plainText = [h2t ToText: html];

NSLog(@"%@",plainText);

// The output looks like this:

// This is a test.
// 
//     Here is text within a blockquote