Using system. Text. regularexpressions;
///
/// Remove HTML tags
///
/// including the source code of HTML
/// removed text
Public static string nohtml (string htmlstring)
{
// Delete the script
Htmlstring = RegEx. Replace
///
/// Remove HTML tags
///
/// including the source code of HTML
/// removed text
Public static string NoHTML (string Htmlstring)
{
// Delete the script
Htmlstring = Regex. Replace (Htmlstring, @ " "," ", RegexOptions. IgnoreCase );
//
First, capture the entire webpage content and place the data in byte [] (the Network upload and transmission form is byte) to further convert it to a string to facilitate its operation. The example is as follows:
Private Static string getpagedata
During website creation, the problem of removing HTML tags is used, matching HTML tags with regular expressions, and then using replace.
Public static stringReplacehtmltag (StringHTML,IntLength = 0 ){StringStrtext = system. Text.
'**************************************************' Function name: gottopic' function: truncated string, Chinese character one count two characters, English count a character' Argument: str----Original string' strlen----intercept length' Return
This article is a PHP deletion of HTML tags in the three solutions to the detailed analysis of the introduction, the need for friends to refer to the
Method 1:directly remove the tag you want to remove
Copy Code code as follows:
//Remove BR
Strip_tags get rid of HTML and PHP tags. Syntax: string strip_tags (String str); Return value: String function type: Data processing content Description This function can remove any HTML and PHP tag strings contained in the string. If the HTML of
Original source: http://blog.csdn.net/xuzengqiang2/article/details/41979733
Introduction: Given that the text is the data that is fetched from the rich editor, sometimes we may not need to display the format, so we need to remove the HTML tags and
Usually we use Htmlspecialchars () to filter HTML, but the character of the HTML is escaped, the final display is the HTML source code.
Use Strip_tags () to get rid of HTML tags.
$str = ' href ';echo Htmlspecialchars ($STR);echo
Method 1: Disable html
The simplest way is to directly disable HTML tags without removing them. You can use the Replace () function. For example:
Strtext = Replace (strtext, "
Or directly disable all HTML:Strtext = Replace (strtext, "
'*************************************** ***********'Function name: gotTopic'Usage: String truncation. One Chinese character is counted as two characters, and one English character is counted as one character.'Parameter: str ---- original
In the Web site, the use of the removal of HTML tags, with the regular match to the HTML tag, and then replace.C # Remove HTML tags Text with HTML tags Intercept length public static string Replacehtmltag (string html, int length = 0) { string
Small functions that remove HTML tags and javascript code
Function trip_html ($ html, $ len ){
// $ Html should contain an HTML document.
// In this example, the HTML tag and javascript code are removed.
This article mainly introduces PHP using Strip_tags () to remove HTML tags still have a blank solution, involving PHP regular replacement of the relevant operating skills, the need for friends can refer to. We hope to help you.
Specific as follows:
-(NSString *) filterhtml: (NSString *) HTML{Nsscanner * scanner = [Nsscanner scannerwithstring:html];NSString * Text = nil;while ([Scanner Isatend]==no){Find the starting position of the label[Scanner scanuptostring:@ "Find the end position of the
Zookeeper
We usually use htmlspecialchars () to filter html, but escape the html characters and display the html source code.
Use strip_tags () to remove html tags.
$ Str = 'href ';// Echo htmlspecialchars ($ str );Echo strip_tags ($ str );
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.