Discover convert html tags to text, include the articles, news, trends, analysis and practical advice about convert html tags to text on alibabacloud.com
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;//First you need to import namespacesusingSystem.Text.RegularExpressions;namespacewindowsformsapplication1{ Public classClass1 {/// ///Convert HTML text to text
First import jar packages into your project: Jsoup-1.7.2.jar (I'm using this version of the jar package)
Tool class: Htmlconverttext.java
Import Org.jsoup.Jsoup;
Import org.jsoup.nodes.Document;
Import org.jsoup.nodes.Element;
Import
Display Mode of html tags (Block-level tags, intra-row tags, intra-row block tags) and Label display mode
During the lecture today, we talked about the tag display mode in html, which is roughly divided into block-level labels and intra-Row labels.
Php converts the br line breaks in html to line breaks in text input. PHP has a very good function: nl2br (), which converts the line break in the text box to the br on the HTML page. but how can we convert the br line break in html to the line
How php deletes html tags
This article introduces three methods to delete html tags using php. For more information, see.Method 1: directly retrieve the desired tag. Use php functions: str_replace, htmlspecialchars, and strip_tags.
","
Replace special characters in HTML
Text that needs to be replaced.
Replace the finished text.
public string HtmlEncode (string thestring)
{
Thestring=thestring.replace (">", ">");
Thestring=thestring.replace ("
Thestring=thestring.replace (""
This article describes the use of PHP to remove HTML tags three ways, with the need for friends, refer to the next bar.Method 1, remove the desired tag directly. PHP functions are used: Str_replace, Htmlspecialchars, Strip_tags.
"," ", $str);/
ASP. NET: (Welcome to discuss)
Because of the differences between the search engine's ASPX page indexing and HTML page indexing rates and the problems with page resource usage, we often need to implement dynamic and static conversion of aspx pages.
The PHP implementation uses the regular to convert the URLs in the text into linked tags,
Copy the Code code as follows:function text2links ($str = ") {if ($str = = "or!preg_match ('/(http|www\.| @)/I ', $str)) {return $str;}$lines = explode ("\ n",
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.