Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - stripTags, HMTL, String, replace, REGEXP

stripTags, HMTL, String, replace, REGEXP

Quickly share your Android Code Snippets here...

stripTags, HMTL, String, replace, REGEXP

Postby plusminus » Sat Oct 04, 2008 3:26 pm

This snippet removes all tags (like [font=Courier New]<b>[/font] from a String):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private String stripTags(final String HTMLString) {
  2.  
  3.       final String noHTMLString = HTMLString.replaceAll("\\<.*?>","");
  4.  
  5.       return noHTMLString;
  6.  
  7. }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Postby mrocket » Sat Oct 04, 2008 3:29 pm

Hey, you could shorten this by one line :P
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private String stripTags(final String pHTMLString) {
  2.  
  3.       return pHTMLString.replaceAll("\\<.*?>","");
  4.  
  5. }
Parsed in 0.010 seconds, using GeSHi 1.0.8.4
mrocket
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Nov 15, 2007 7:28 pm

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 4 guests