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 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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…