Reputation: 1239
hi I have input as follows:
"Java technology's versatility, efficiency,
<br/>
<br/>
platform portability, and security make it the ideal technology for network computing.<div/>
"
I want to remove <br/>
& <div/>
tag from above input.And I want output as follows:
Output:-"Java technology's versatility, efficiency, platform portability, and security make it the ideal technology for network computing."
Please help me how to remove these tags,What will be the java code to get above output?
Upvotes: 0
Views: 142
Reputation: 533492
You can try
String unsafe = "Java technology's versatility, efficiency, <br/> <br/> platform portability, and security make it the ideal technology for network computing. <div/>";
String safe = unsafe.replaceAll("<[^>]+>", "")
Upvotes: 2
Reputation: 46395
Go for htmlParser.
Lots of helping hand :
Upvotes: 0
Reputation: 240870
Use JSoup Cleaner to remove HTML stuff.
Example :
String unsafe = "your string containing html";
String safe = Jsoup.clean(unsafe, Whitelist.basic());
Upvotes: 3