Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi.

 

How do I display all the info from my DB as plain text even if someone have entered som HTML och som other code into the post field in my forum

 

Ex. If someone replays to a message in my forum and enter this into to the the text field:

<font size='7'>Test</font>

 

How do I make so when I get the info from the DB so it wont display test in size seven insted it should write out <font size='7'>Test</font>

 

Do you understand what Im want to do?

 

//Andi

Posted

What you are looking for are Regular Expressions (System.Text.RegularExpression)

 

Solution for your prob:

string inputString = "<big>test</big>";
		Regex r = new Regex("<[^>]*>");
		string HtmlCuttedString = r.Replace(inputString, "");

Regards!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...