Thread Rating:
- 0 Vote(s) - 0 Average
- 1
- 2
- 3
- 4
- 5
[C#] Strip HTML from string.
|
Posts: 95
Threads: 5
Joined: Apr 2010
Reputation:
0
(04-05-2010, 05:43 PM)Yin Wrote: Code: ///<summary>
///method to strip HTML tags from a string
///</summary>
///<param name="str">the string to strip</param>
///<returns></returns>
///<remarks></remarks>
public string StripHTML(string str)
{
try
{
int start = 0;
int end = 0;
int count = 0;
while (((str.IndexOf("<") > -1) && (str.IndexOf(">") > -1) && (str.IndexOf("<") < str.IndexOf(">"))))
{
start = str.IndexOf("<");
end = str.IndexOf(">");
count = end - start + 1;
str = str.Remove(start, count);
}
str = str.Replace(" ", " ");
str = str.Replace(">", "");
str = str.Replace("\r\n", "");
return str.Trim();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
Enjoy.
Nice dude,thanks
|
Messages In This Thread |
RE: [C#] Strip HTML from string. - by RaZoR03 - 04-18-2010, 12:21 AM
|
Possibly Related Threads… |
Thread |
Author |
Replies |
Views |
Last Post |
|
Encrypt String using x509Certificate private Key wih RSA |
jeffstan |
0 |
2,438 |
01-26-2014, 04:18 PM
Last Post: jeffstan
|
|
HTML Grabber v1 |
BreShiE |
18 |
6,263 |
09-28-2012, 01:15 AM
Last Post: rqmok
|
|
Combination Cracker - String Variant Builder - Developed by AceInfinity |
AceInfinity |
0 |
1,354 |
03-15-2012, 06:05 PM
Last Post: AceInfinity
|
|
String MD5 Hasher (Coded by Ace) |
AceInfinity |
20 |
7,382 |
10-10-2011, 11:57 AM
Last Post: Greyersting
|
|
[Source] TripleDES String Encryption / Decryption |
euverve |
2 |
3,362 |
05-13-2011, 10:35 AM
Last Post: Imports System.Net
|
Users browsing this thread: 4 Guest(s)