1: // 2: /// Remove HTML tags 3: // 4: /// including HTML source code 5: /// removed text after 6: public staticstring removehtml (string htmlstring) 7: { 8: if
First, the Web page content of the entire crawl down, the data put in byte[] (network transmission on the form of byte), further converted to string, so as to facilitate its operation, examples are as follows:
Copy Code code as follows:
MySQL itself does not have built-in functions to remove HTML code, but in some cases it has to extract some plain text from the database hierarchy that removes the HTML code.
After Google, found the following two functions, tested, are available.
function Killhtmllabel (str) ' Functions start
Dim N,m,str2 ' defines three variables
n = InStr (str, "m = InStr (str, ">") ' Find the location of the first ' > '
str2 = Str ' assigns the value of STR to STR2
Do While n > 0 and N 0 indicates
one is to use the HTA to remove the HTM control validation
The code for HTA1 is as follows:
Copy Code code as follows:
sample HTML Application One
The activexcontrol.htm code is as follows:
Method One: Disable HTMLThe easiest way to do this is to disable HTML tags directly without removing them. You can use the Replace () function. For example:
StrText = Replace (StrText, "
or disable all HTML directly:StrText = Replace (StrText,
HTML tags | Just because of my previous time XMLHTTP bulk crawl Remote Data articles
Http://blog.csdn.net/babyt/archive/2004/09/08/98516.aspx
Recently someone asked me how to save the article in text format instead of using HTML directly, which
When we use ckeditor or some other online text editors, there are a lot of labels in the content:
A journey of life, a journey of scenery, a journey of prosperity. Open the window of the soul, watching the time and the flowers bloom, watching the
Ec (2); this method removes any HTML and PHP tag strings contained in the string, such as {str"
This method removes any HTML and PHP tag strings contained in the string, for example:
$ Str ="
Text Content
";
Echo "
Strip_tags Definition and usage
The Strip_tags () function strips the HTML, XML, and PHP tags from the string.
Note: This function always strips HTML comments. This cannot be changed by the Allow parameter.
Note: This function is binary safe.
PHPstrip_tags () removes HTML, XML, and PHP labels. Syntax: strip_tags (string, allow); string required, specifying the string to be checked. (Optional) allowed tags. these tags are not deleted. Note: This function will always be stripped
This article mainly introduces PHP to delete the HTML code in the wide-height style of the method, involving PHP for HTML code of regular matching, replacement and other operational skills, the need for friends can refer to the following
The
Usually we use Htmlspecialchars () to filter the HTML, but the HTML characters escaped, the final display is the HTML source code.
You can use Strip_tags () to get rid of HTML tags.
$str = ' href ';echo Htmlspecialchars ($STR);echo
/// /// Convert the HTML tag to Kong Jia Shiyi/// /// string to be converted /// converted string Public static string getstringnohtml (string strhtml){If (string. isnullorempty (strhtml )){Return strhtml;}Else{String [] aryreg = {@ " ",@ " )? ",@
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.