Tell everybody a good news. Remove the HTML mark in the string and no longer need to write regular expressions. Do you know? One rowCodeThat's enough!
It's not too late. Come on.
1. Create a new "Panel tile" ApplicationProgramProject.
2. Put a textbox on the interface to input HTML text, a button, click to convert, and a textblock to display the converted string. The XAML is as follows:
<Page X: class = "app1.mainpage" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns: Local = "using: app1" xmlns: D = "http://schemas.microsoft.com/expression/blend/2008" xmlns: MC = "http://schemas.openxmlformats.org/markup-compatibility/2006" MC: ignorable = "D"> <grid background = "{staticresource applicationpagebackgroundthemebrush}"> <grid. rowdefinitions> <rowdefinition/> <rowdefinition Height = "Auto"/> <rowdefinition/> </grid. rowdefinitions> <textbox X: Name = "txtinput" grid. row = "0" textwrapping = "Wrap"/> <button grid. row = "1" margin = "," content = "convert" Click = "onclick"/> <scrollviewer grid. row = "2" verticalscrollbarvisibility = "visible" horizontalscrollmode = "enabled"> <textblock X: name = "tbresult" fontsize = "24" textwrapping = "Wrap"/> </scrollviewer> </GRID> </Page>
3. Then we process the click event in the code. Remember to introduce the windows. Data. html namespace first.
Private void onclick (Object sender, routedeventargs e) {This. tbresult. Text = htmlutilities.converttotext(this.txt input. Text );}
Then, try it.