Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6831485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:44:34+00:00 2026-05-26T22:44:34+00:00

I want to decode HTML string and store it in NSString. following is the

  • 0

I want to decode HTML string and store it in NSString.

following is the html string for one of the response from google direction api.

teststring is Turn <b>right</b> onto <b>Kennington Park Rd/A3</b><div style="font-size:0.9em">Continue to follow A3</div><div style="font-size:0.9em">Entering toll zone in 1.7&nbsp;km at Newington Causeway/A3</div><div style="font-size:0.9em">Go through 2 roundabouts</div>

I want to store this html string in Array of 4 different NSStrings with following 4 NSStrings (removing all information for size colour)

Turn right onto Kennington Park Rd/A3
Continue to follow A3
Entering toll zone in 1.7 km at Newington Causeway/A3
Go through 2 roundabouts

I have used following method to convert html string to plain text.(html_response is the response from server and stringByConvertingHTMLToPlainText is the method defined in custom class file)

testString = (NSString*) [html_response stringByConvertingHTMLToPlainText];
NSLog(@"%@",testString);

but it converts whole string instead of breaking it in parts.
output at the console is

Turn right onto Kennington Park Rd/A3Continue to follow A3 Entering toll zone in 1.7 km at Newington Causeway/A3 Go through 2 roundabouts

So do I need to write custom method to do this? Any help will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:44:35+00:00Added an answer on May 26, 2026 at 10:44 pm

    There’s a very nice NSString category that you can use, it’s a part of the project MWFeedParser. More specifically, you look for the file NSString+HTML.

    The NSString+HTML category adds the following methods to the NSString Class,

    - (NSString *)stringByStrippingTags;
    - (NSString *)stringWithNewLinesAsBRs;
    - (NSString *)stringByRemovingNewLinesAndWhitespace;
    - (NSString *)stringByDecodingHTMLEntities;
    - (NSString *)stringByEncodingHTMLEntities;
    

    You could then try something like:

    NSString *summary = [[[htmlString stringByStrippingTags] stringByRemovingNewLinesAndWhitespace] stringByDecodingHTMLEntities];
    

    Hope it helps!, good luck 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Delphi 2009 and want to decode an HTML encoded string, for example:
I want to encode and decode Bitmap object in string base64 . I use
I get a string from database that includes a HTML styling (not sure what
I am trying to use Regular Expressions to decode some HTML I retrieve from
i dont want the xslt to decode xml like chngeing html sequence and other
I want o pass some JSON object in HTML response and eval it in
I want to use Google Language Detection API in my app to detect language
I have a function that takes a string-like argument. I want to decide if
want to know why String behaves like value type while using ==. String s1
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.