Some times we need to remove HTML tags from a java string before publishing it to the page. We can achieve this by using a regular express. Sample code is given below for your reference.
public class RemoveTags{
public static void main(String a[]){
String text = "<b>I dont want this to be bold<\b>";
text = text.replaceAll("\\<.*?\\>", "");
System.out.println(text);
}
}
Output:
I dont want this to be bold
Search This Blog
Monday, August 30, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment